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]
Other format: [Raw text]

link error


I make my own library using this makefile.
===================================================================
TARGET := xyDEVS
CC := g++
CFLAGS := -c -fpermissive

######################################
# use following way:
#> make "CONFIG = Debug"
#or
#> make "CONFIG = Release"
######################################
ifeq (,$(findstring Debug,$(CONFIG)))
    CFLAGS += -fPIC -O2 -DNDEBUG
    MODI =
    CONFIG = Release
else
    CFLAGS += -fPIC -g -D_DEBUG
    MODI := D
    CONFIG = Debug
endif

SRCDIR := ./
SRC := $(wildcard Dv*.cpp)
SRC := $(notdir $(SRC))

OBJDIR := ../../../Linux/Object/$(CONFIG)
OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)

LIBDIR := $(HOME)/lib/$(CONFIG)
#LIBDIR := $(HOME)/lib
SONAME := lib$(TARGET)$(MODI).so
LIB := $(LIBDIR)/$(SONAME).1.0.1
LIBSONAME := $(LIBDIR)/$(SONAME)

#INC := $(wildcard Dv*.h) $(wildcard Dv*.inl) $(wildcard Dv*.pkg)\
#       $(wildcard Dv*.mcr)
#INC := $(notdir $(INC))

BOOST = /usr/local/include/boost_1_32_0
INCDIR := ../../Include

SDKDEL := $(INC:%=$(INCDIR)/%)

$(TARGET) : $(OBJ)
	@mkdir -p $(INCDIR)
	@mkdir -p $(OBJDIR)
	@mkdir -p $(LIBDIR)
	$(CC) -shared -Wl,-soname,$(SONAME) -o $(LIB) $(OBJ) -lc
	@ln -s $(LIB) $(LIBSONAME)

clean :
	rm -f $(LIB)
	rm -f $(LIBSONAME)
	rm -f $(OBJ)
	rm -f $(SDKDEL)


$(OBJDIR)/%.o : %.cpp
	@mkdir -p $(OBJDIR)
	$(CC) -I$(INCDIR) -I$(BOOST) $(CFLAGS) $< -o $@

================================================= End of Makefile

So the library looks be created as follows
================================================================
total 900
drwxr-xr-x+ 2 MHHwang None      0 Oct 21 13:04 .
drwxr-xr-x+ 4 MHHwang None      0 Oct 21 13:08 ..
lrwxrwxrwx  1 MHHwang None     44 Oct 21 13:04 libxyDEVS.so ->
/home/MHHwang/lib/Release/libxyDEVS.so.1.0.1
-rwxr-xr-x  1 MHHwang None 867547 Oct 21 13:04 libxyDEVS.so.1.0.1
====================================================End of List
But I cannot use the library when I use this make file

 And I try make an application using xyDEVS library. I uses following makefile
============================================================
#####################################################################
# .bash_profile should contains
# LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib/Release:$HOME/lib/Debug
# export LD_LIBRARY_PATH
#####################################################################
# use following way:
#> make "CONFIG = Debug"
#or
#> make "CONFIG = Release"
#####################################################################

.SUFFIXES : .cpp .o

TARGET := Bomb
CC := g++

ifeq (,$(findstring Debug,$(CONFIG)))
    CFLAGS := -c -O2 -DNDEBUG
    MODI =
    CONFIG = Release
else
    CFLAGS := -c -g -D_DEBUG
    MODI = D
    CONFIG = Debug
endif


LIBDIR := -L /usr/X11R6/lib -L ${HOME}/lib/$(CONFIG)
INCDIR := -I /usr/X11R6/include -I ../../../Include -I
/usr/local/include/boost_1_32_0
LIBS := -lxyDEVS$(MODI) -lpthread

$(TARGET) : $(OBJECTS)
	$(CC) $(INCDIR) $(LIBDIR) $(TARGET).cpp -o $(TARGET) $(OBJECTS) $(LIBS)

#.cpp.o:
#	$(CC) $(CFLAGS) $(INCDIR) $< -o $@
clean:
	rm -rf $(OBJECTS) $(TARGET) core
====================================================== End of makefile

But I just get this error message
======================================================
g++ -I /usr/X11R6/include -I ../../../Include -I
/usr/local/include/boost_1_32_0 -L /usr/X11R6/lib -L
/home/MHHwang/lib/Release Bomb.cpp -o Bomb  -lxyDEVS -lpthread

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
cannot find -lxyDEVS
collect2: ld returned 1 exit status
make: *** [Bomb] Error 1
============================================== End of Error message

Why I got the error message when using gcc 3.4.4 but not using gcc 2.96 ?

Anybody?

MoonHo


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