I want to build a library rather than an executable
Jan Croker
jan@theRTDC.com
Wed Oct 20 10:12:00 GMT 2004
Anyone,
I am currently porting an existing application from Solaris 2.6 to Solaris
2.9 and switching to the GNU compiler 3.4.1 as well!! (previously used the
Sun compiler)
As a first stab, I am just trying to build a library that is used by the
other applications.
I can compile OK but I keep hitting a link problem that reports:
Building the Common library
Undefined first referenced
symbol in file
main
/usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.1/crt1.o
ld: fatal: Symbol referencing errors. No output written to libcommon.a
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `all'
Is there any way that I can force the linker to ignore looking for 'main' as
this is not a requirement when building a library.
The relevant lines in the makefile are:
OBJECTS = $(SRCS:.cpp=.o)
LDFLAGS = -L. \
-L/usr/local/lib -lstdc++\
-L/usr/local/lib/gcc/sparc-sun-solaris2.9/3.4.1 -lgcc\
-lnsl -lsocket -lthread -lposix4
.SUFFIXES : .cpp
.cpp.o :
@echo "Compiling '$<'"
@$(CPLUSPLUS) -c $(CCFLAGS) $(DEBUG) $(INCLUDE) $<
all : $(OBJECTS); @echo "Building the Common library"
@$(CPLUSPLUS) -o $(LIB) $(LDFLAGS) $(DEBUG) $(OBJECTS)
where CPLUSPLUS = g++
If anyone can help, I would appreciate it because I am banging my head on
the wall at the moment!!!
Jan
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 29/07/2004
More information about the Gcc-help
mailing list