(g++2.95) can't link to lib
Igor Markov
imarkov@cs.ucla.edu
Fri Oct 1 00:00:00 GMT 1999
I am not able to link a sample main() to a sample static library.
g++ -c libSample.cxx main.cxx
g++ libSample.o main.o
i.e., works
ar cr libSample.a libSample.o
g++ libSample.a libSample.o
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
i.e., does not work
g++ -shared -o libSample.so libSample.o
g++ libSample.so main.o
i.e., works
./a.out
./a.out: error in loading shared libraries: libSample.so: cannot open shared
object file: No such file or directory
this doesn't work... how do I embed the library's location into the
executable? (-h and -R options for SunPro CC, but I can't find anything
similar for gcc and -B does not seem to do the job).
Thanks,
Igor
--
Igor Markov office: (310) 206-0179
http://vlsicad.cs.ucla.edu/~imarkov
More information about the Gcc-help
mailing list