public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* "Cannot find" error
@ 2007-12-10 23:54 Petrus B. van Bork
  2007-12-11  3:47 ` corey taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Petrus B. van Bork @ 2007-12-10 23:54 UTC (permalink / raw)
  To: gcc-help


Dear gcc-help:

I humbly admit that I have not used gcc since 1993 and that I am very 
rusty.  To add to my misery I am using all new tools - Eclipse with CDT 
4.0.2 mingw gcc 3.4.5 etc.

All was going well until I tried to install the Boost libraries and 
since I have been through, literally, two weeks of Hell.  I am now at 
the point that I get the below console output.  The Boost list says that 
it is a gcc issue and that my syntax for '-l' is incorrect.  These are 
bright guys if not very newby friendly and I am sure that they are right 
but when I look at gcc documentation, I do not see what I am doing 
wrong!  I feel incredibly stupid and it may be a 'flat forehead' error 
but I really, truly don't know what I am doing wrong.   The boost guys 
also say it would be better if I had their directory in the "install 
tree" - if I understand them correctly, this is what caused a major 
previous problem with their demo program running all their regression 
tests while trying to compile, however.  I don't mind reading manuals 
and docs but maybe there is something for beginners on getting the 
linker options right?  Everything is very cryptic and there don't seem 
to be any examples at:

http://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Overall-Options.html#Overall-Options
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

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

Best,

Petrus


**** Build of configuration Debug for project BoostTest ****

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "Cannot find" error
  2007-12-10 23:54 "Cannot find" error Petrus B. van Bork
@ 2007-12-11  3:47 ` corey taylor
  0 siblings, 0 replies; 2+ messages in thread
From: corey taylor @ 2007-12-11  3:47 UTC (permalink / raw)
  To: pvanbork; +Cc: gcc-help

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-11  3:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-10 23:54 "Cannot find" error Petrus B. van Bork
2007-12-11  3:47 ` corey taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).