This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "Cannot find" error


> http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Directory-Options.html#Directory-Options
> http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Link-Options.html#Link-Options

These two you will need.

> Please help me, I am very, very desperate.  Why is the syntax wrong?
> Why do I get this error?

You get the error because the file cannot be found :) But that's
stating the obvious.

> mingw32-make all
> 'Building target: BoostTest.exe'
> 'Invoking: MinGW C++ Linker'
> g++
> -Le:\BoostCPlusLibraries\bin\boost_1_34_1\bin.v2\libs\filesystem\build\gcc-mingw-3.4.5\debug\-lboost_filesystem-mgw34-d-1_34_1
> -Wl,--out-implib=boost -o"BoostTest.exe"  ./main.o
> -le:\BoostCPlusLibraries\boost_1_34_1\bin.v2\libs\filesystem\build\gcc-mingw-3.4.5\debug\boost_filesystem-mgw34-d-1_34_1.a
> e:\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe:
> cannot find
> -le:\BoostCPlusLibraries\boost_1_34_1\bin.v2\libs\filesystem\build\gcc-mingw-3.4.5\debug\boost_filesystem-mgw34-d-1_34_1.a
> collect2: ld returned 1 exit status
> mingw32-make: *** [BoostTest.exe] Error 1

I assume this is your build script and you can change this.

>From the linker options described in the documentation above, the -l
option (lower case L) essentially tells the linker to look for
libname.a where name comes after -l (eg. -lname).  I assume you're
familiar with .a files and any linking order requirements (some
information is posted in the docs but you can search).

The option -L lets you specify directories in which the libname.a is
searched for without having to provide a full path to each object
file.  Your directory name is rather difficult but I assume
"-lboost_filesystem-mgw34-d-1_34_1" at the end of the -L option is
actually your library name?  In that case, you need to leave it out of
the -L option and only provide a directory (eg.
-Le:\BoostCPlusLibraries\bin\boost_1_34_1\bin.v2\libs\filesystem\build\gcc-mingw-3.4.5\debug).

Then, with the proper -L option, you can use -l to specify an archive
(.a) file and it should be found in the -L directory (searched other
places as well). So that option would be (I think for you)
-llboost_filesystem-mgw34-d-1_34_1  .

I'm pretty sure the full filename is
libboost_filesystem-mgw34-d-1_34_1.a even though you don't use that in
your command so that will probably work.

corey


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]