开发者

Eclipse c++ with mingw comiler cant build boost regex example, can find .a library files

开发者 https://www.devze.com 2022-12-30 21:00 出处:网络
I\'m trying to build the boost regex example in eclipse using mingw on vista. I built boost ok with mingw as there are library files XXXX.a.

I'm trying to build the boost regex example in eclipse using mingw on vista. I built boost ok with mingw as there are library files XXXX.a. I could build/compile the first boost example that doesnt require any of the compiled boost libraries.

When I compile the regex example I get a linker error saying it cant find the 开发者_运维问答library file. I have tried various libray file names eg leave off the .a extension, leave off the lib prefix etc.

Now the interesting thing is that if I leave off the library extension and rename the library file to XXX.lib it works and runs ok.

So why cant it read the .a library file?

It must be my setup somewhere but I dont know where or what to set.

From what I read everyone is ok linking the .a file except me :(

Thanks in advance, Kim


Is this similar to this thread?

I built the stock Hello World with no problems and added a second "utilities" static library project for practice. I did the following:

  • checked "utilities" as a project reference for Hello World.
  • added libutilities as as a lbrary to "Hello World" project library list.
  • added "${workspace_loc:/utilities/Debug}" as the dir path for libs. (libutilities.a lives there). (also tried the "file system" version of this.)
  • Clean and build results in the following error:
g++ -LC:\projects\fargo\utilities\Debug -ohello_world.exe src\hello_world.o
  src\c_template_class.o -llibutilities
C:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:  
  cannot find -llibutilities
collect2: ld returned 1 exit status

To link a library libutilities.a, the command line option should be -lutilities

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号