public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Moon Hwang <moon.hwang@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: link error
Date: Fri, 21 Oct 2005 20:22:00 -0000	[thread overview]
Message-ID: <7adf9af0510211322q39d3a0eag@mail.gmail.com> (raw)

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

             reply	other threads:[~2005-10-21 20:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-21 20:22 Moon Hwang [this message]
2005-10-21 23:08 ` Brian Dessent
     [not found] <AANLkTiniPnQ-ioijpQXhMC1ygSqNSZsEGW2O-OVS5Qa8@mail.gmail.com>
2010-08-12 10:18 ` Link error Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2009-04-01 13:23 link error Duan Wang
2009-04-01 13:42 ` Axel Freyn
2008-08-15 20:39 Link error Vardhan, Sundara (GE Infra, Energy)
2008-07-24 21:03 Vardhan, Sundara (GE Infra, Energy)
2008-07-24 23:55 ` Rob Sherry
2008-07-25 13:32   ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 11:41     ` Andrew Haley
2008-07-28 12:14       ` Vardhan, Sundara (GE Infra, Energy)
2008-07-28 13:26         ` Andrew Haley
2008-07-29  8:56           ` Ralf Wildenhues
2008-07-29 11:49             ` Andrew Haley
2008-07-29 13:43               ` Vardhan, Sundara (GE Infra, Energy)
2008-07-24 10:04 Vardhan, Sundara (GE Infra, Energy)
2002-10-17  8:11 HKOELMAN
2002-08-13  6:54 Link Error Tom Browder
2002-08-13  7:16 ` Ish Rattan
2002-08-13  7:30   ` Tom Browder
2002-08-13  7:59     ` Ish Rattan
2001-06-05 14:22 link error Alex Fridman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7adf9af0510211322q39d3a0eag@mail.gmail.com \
    --to=moon.hwang@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).