我想在Cygwin中編譯一個簡單的ANTLR3項目(使用C目標構建)。我已經使用標準./configure
,make
,make install
方式安裝在C運行時庫和庫出現安裝成功(頭文件安裝在/cygdrive/e/cygwin/usr/local/include/
和庫文件是/cygdrive/e/cygwin/usr/local/lib/
。無法在cygwin下編譯ANTLR3項目,在OSX上工作正常
當我使用g ++編譯(我使用C++爲項目的其餘部分 - C++目標不必產生的AST的能力),並且所有的編譯罰款的文件,但鏈接失敗時使用:
g++ -m32 -o compile Main.o Lexer.o Parser.o
給出了錯誤
。Main.o:Main.cpp:(.text+0xfc): undefined reference to `_antlr3AsciiFileStreamNew'
Main.o:Main.cpp:(.text+0x12b): undefined reference to `_antlr3CommonTokenStreamSourceNew'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: Main.o: bad reloc address 0x0 in section `.ctors'
collect2: ld returned 1 exit status
添加-lantlr3c
標誌該命令也不起作用,雖然錯誤是不同的:
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find -lantlr3c
collect2: ld returned 1 exit status
make: *** [compile] Error 1
最後,保持庫文件的本地目錄,並使用'-L「標誌也沒有按」 t工作:
Main.o:Main.cpp:(.text+0xfc): undefined reference to `_antlr3AsciiFileStreamNew'
Main.o:Main.cpp:(.text+0x12b): undefined reference to `_antlr3CommonTokenStreamSourceNew'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: Main.o: bad reloc address 0x0 in section `.ctors'
collect2: ld returned 1 exit status
第一個命令在OSX上正常工作。任何人有任何想法?我認爲這可能與Cygwin奇怪的文件結構/安裝位置的選擇有關,但我不確定。
是的,那篇文章很有用。最後我放棄了試圖讓它在cygwin上工作,只是在Ubuntu VM中工作。我會接受這個答案的基礎上,你提供的有關3.4的變化的信息是花了我很長時間才發現的。 –