I want to build a library rather than an executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux