views:

256

answers:

1

Hi, 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

A: 

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

VonC
Cool, it seems to work now! :)Im sured I tried it several times like that before but didnt work.Oh well it must of been me ... :(Thanks:)
Kim