LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-26-2011, 05:47 AM   #1
Omar k
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
/usr/bin/ld Error!


Hi guys,

I'm having some troubles compiling a program on kubuntu lucid;

well the program is a Kinect example, so I used this makefile :

PS: I'm a new ubuntu/kubuntu user so please help me.


CC=g++

# Obsolete
# OPENCV = -lcv -lcxcore -lhighgui -lml -lcvaux
OPENCV = -lopencv_core \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_video \
-lopencv_legacy \
-lopencv_features2d \
-lopencv_objdetect \
-lopencv_video

OTHERS = -lcvutils -lmylib -lbloblib -lconfig -lOpenNI -lXnVNite -fopenmp #\
#-lblitz -lboost_filesystem-gcc \
#-lclassifier -lcmdline \
#-lcvip -llearutil



LIBNAME = $(OPENCV) $(OTHERS)

LIBPATH = -L$(HOME)/lib/opencvTrunk/lib/ \
-L$(HOME)/lib/cvutils/lib/ \
-L$(HOME)/lib/bloblib/lib/ \
-L$(HOME)/lib/mylib/lib/ \
-L$(HOME)/lib/libconfig/lib/ \
-L$(HOME)/lib/daisy/lib/ \
-L$(HOME)/lib/peopleDetector/

INCLUDEPATH = -I$(HOME)/lib/opencvTrunk/include/opencv/ \
-I$(HOME)/lib/opencvTrunk/include/ \
-I$(HOME)/lib/cvutils/include/ \
-I$(HOME)/lib/bloblib/include/ \
-I$(HOME)/lib/mylib/include/ \
-I$(HOME)/lib/libconfig/include/ \
-I$(HOME)/lib/daisy/include/ \
-I$(HOME)/lib/daisy/include/daisy/ \
-I/usr/include/nite/ \
-I/usr/include/ni/ \
-I$(HOME)/lib/gnuplotLib/

ifeq ($(mode),release)
# RELEASE
CFLAGS = $(LIBPATH) -o3 $(INCLUDEPATH)
else
mode = debug

# DEBUG
CFLAGS = $(LIBPATH) -ggdb -o0 $(INCLUDEPATH)
endif


SRCS = $(wildcard src/*.cpp)

OBJS = $(SRCS:.cpp=.o)

EXE = build/Executable



all: $(SRCS) $(EXE)



$(EXE): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) $(LIBNAME) -o $@


.cpp.o:
$(CC) -static $(CFLAGS) $(LIBNAME) -c $< -o $@


clean:
rm -f $(OBJS)
rm -f $(EXE)

redo:
make clean
make all


but when a type make on the terminal, I get this:

g++ -L/home/omar/lib/opencvTrunk/lib/ -L/home/omar/lib/cvutils/lib/ -L/home/omar/lib/bloblib/lib/ -L/home/omar/lib/mylib/lib/ -L/home/omar/lib/libconfig/lib/ -L/home/omar/lib/daisy/lib/ -L/home/omar/lib/peopleDetector/ -ggdb -o0 -I/home/omar/lib/opencvTrunk/include/opencv/ -I/home/omar/lib/opencvTrunk/include/ -I/home/omar/lib/cvutils/include/ -I/home/omar/lib/bloblib/include/ -I/home/omar/lib/mylib/include/ -I/home/omar/lib/libconfig/include/ -I/home/omar/lib/daisy/include/ -I/home/omar/lib/daisy/include/daisy/ -I/usr/include/nite/ -I/usr/include/ni/ -I/home/omar/lib/gnuplotLib/ -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_video -lopencv_legacy -lopencv_features2d -lopencv_objdetect -lopencv_video -lcvutils -lmylib -lbloblib -lconfig -lOpenNI -lXnVNite -fopenmp -o build/Executable
/usr/bin/ld: cannot open output file build/Executable: No such file or directory
collect2: ld returned 1 exit status
make: *** [build/Executable] Errore 1
 
Old 03-26-2011, 05:49 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Does the directory "build" exist? If not, you probably need to create it first.

Edit: a quick test confirms this. If you don't know how to create directories on the command line, you use the command "mkdir", e.g.

$ mkdir foo

will create the directory "foo" in the current directory.

Last edited by Nylex; 03-26-2011 at 05:54 AM.
 
Old 03-26-2011, 06:02 AM   #3
Omar k
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you Nylex for the quick answer,

I did create the buil directory and now I have this:

$ make
g++ -L/home/omar/lib/cvutils/lib/ -L/home/omar/lib/bloblib/lib/ -L/home/omar/lib/mylib/lib/ -L/home/omar/lib/libconfig/lib/ -L/home/omar/lib/daisy/lib/ -L/home/omar/lib/peopleDetector/ -ggdb -o0 -I/home/omar/lib/opencvTrunk/include/opencv/ -I/home/omar/lib/opencvTrunk/include/ -I/home/omar/lib/cvutils/include/ -I/home/omar/lib/bloblib/include/ -I/home/omar/lib/mylib/include/ -I/home/omar/lib/libconfig/include/ -I/home/omar/lib/daisy/include/ -I/home/omar/lib/daisy/include/daisy/ -I/usr/include/nite/ -I/usr/include/ni/ -I/home/omar/lib/gnuplotLib/ -lcv -lcxcore -lhighgui -lml -lcvaux -lOpenNI -lXnVNite -fopenmp -o build/Executable
/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [build/Executable] Errore 1

do I have to pass the name of the program like: $ make main , or just $ make.

thank you very much,

Omar.
 
Old 04-10-2011, 01:33 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Sorry for the delay. I've not really had time for LQ recently.

Just running "make" should work. Looking at your compile command, though, it seems that you're not actually passing any source files! All I see are library and include paths. There's probably an error in your makefile, then. However, I don't know too much about those, so I may not be able to help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Kickoff Application Launches from /usr/bin rather than /usr/local/bin Tim Johnson Slackware 2 05-26-2010 09:36 PM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 08:33 AM
Failed to chck remot comnd executin using shells /usr/bin/ssh and /usr/bin/rsh farnaw4u Linux - Software 2 04-06-2009 12:08 AM
Error when starting up snort: bash:!/bin/sh/usr/local/bin/snort :Eent not found cynthia_thomas Linux - Software 1 11-11-2005 02:59 PM
path in services wrong for clamav updated frm 0.75 to 0.80 usr/bin vs usr/local/bin Emmanuel_uk Linux - Newbie 3 04-22-2005 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration