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]

RE: About Linking of a simple C++ prog.



>   I have tried g++ & gcc -lstdc++, it doesn't work either, although 
>   the error messages is different as follows:
> $PWD$g++ test.cpp
> $PWD$./a.out
> ld.so.1: ./a.out: fatal: libstdc++.so.2.10.0: open failed: No such file or direc
> tory
> Killed

Your program linked correctly this time, as an executable was created, but
your executable can't find libstdc++.so at runtime.  There are a couple of
options:

	- you can tell the executable where to look  e.g. on Solaris, you
	  would set the environment variable 

		setenv LD_RUN_PATH <path_to_libstdc++>

	- you can recompile, this time hardwiring the runtime search path
	  into the executable:

		g++ -Wl,-rpath <path_to_libstdc++> test.cpp

	  assuming your g++ was configured to use GNU ld
	  note that that's an ell, not numeric 'one'


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