簡體   English   中英

鏈接錯誤:使用MinGW的Windows上的Boost庫

[英]Linking Error: Boost Library on Windows using MinGW

我正在使用Windows 7 64x並安裝了MinGW。

我的目標是在Eclipse上使用boost庫(在這里: boost_program_options )。

Boost庫已正確安裝,我可以在C:\\MinGW\\boost_1_53_0\\stage\\lib下看到文件libboost_program_options-vc90-mt-gd-1_53.lib

現在,我嘗試通過轉到Properties -> C/C++ Build -> Settings -> MinGW C++ Linker -> Libraries來在Eclipse中鏈接此Properties -> C/C++ Build -> Settings -> MinGW C++ Linker -> Libraries

在這里,我輸入Library Search Path-L ): C:\\MinGW\\boost_1_53_0\\stage\\libLibraries-l ): boost_program_options-vc90-mt-gd-1_53

嘗試構建時,出現以下錯誤消息:

11:06:54 **** Build of configuration Debug for project AP ****
make all 
Building file: ../src/HW1EX1.cpp
Invoking: GCC C++ Compiler
g++ -I"C:\MinGW\boost_1_53_0" -I"C:\MinGW\boost_1_53_0\boost\program_options" -I"C:\MinGW\boost_1_53_0\boost" -I"C:\MinGW\boost_1_53_0\boost\program_options\detail" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/HW1EX1.d" -MT"src/HW1EX1.d" -o "src/HW1EX1.o" "../src/HW1EX1.cpp"
Finished building: ../src/HW1EX1.cpp

Building target: AP.exe
Invoking: MinGW C++ Linker
g++ -LC:\MinGW\boost_1_53_0\stage\lib -static-libgcc -o "AP.exe"  ./src/HW1EX1.o   -lboost_program_options-vc90-mt-gd-1_53
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lboost_program_options-vc90-mt-gd-1_53
collect2: ld returned 1 exit status
make: *** [AP.exe] Error 1

11:06:57 Build Finished (took 3s.80ms)

有人知道我在做什么錯嗎?

感謝您的時間

您顯然已經下載了使用Microsoft Visual C ++編譯器編譯的二進制發行版( ...-vc90-...是提示)。 或者,也許您是自己構建的,但是您是使用Microsoft Visual C ++編譯器完成的。 您必須使用MinGW從源代碼構建Boost,因為您無法混合使用其他C ++編譯器生成的C ++代碼。 換句話說,根據您的情況,您無法使用MinGW鏈接到Microsoft Visual C ++編譯器生成的庫。

另外,我懷疑-LC:\\MinGW\\boost_1_53_0\\stage\\lib無法正常工作,因為存在反斜杠並且沒有引用它。 因此它應該是-L"C:\\MinGW\\boost_1_53_0\\stage\\lib"-LC:/MinGW/boost_1_53_0/stage/lib 我希望使用第二種變體,因此請嘗試將反斜杠更改為正斜杠,然后看看它如何進行。 還要libboost_program_options-mgw46-1_53.a檢查libboost_program_options-mgw46-1_53.a是否確實在C:\\MinGW\\boost_1_53_0\\stage\\lib

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM