LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-16-2013, 02:45 PM   #1
s.arzandeh
LQ Newbie
 
Registered: Jul 2013
Posts: 23

Rep: Reputation: Disabled
Error after make command to creat obj file


Dear friends,
I encounter an error after compiling Buddy.cpp with make command. (although Buddy.o is created) following is the error:

Buddy/Buddy.o: In function `BuddyClass::create(int, char const* const*)':
Buddy.cc.text._ZN10BuddyClass6createEiPKPKc[BuddyClass::create(int, char const* const*)]+0x1d): undefined reference to `Buddy::Buddy()'
collect2: ld returned 1 exit status
make: *** [ns] Error 1

can anybody help me?
 
Old 07-16-2013, 02:47 PM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
You seem to be missing a library reference... or maybe an object file containing the "Buddy()" function.
 
Old 07-17-2013, 01:36 AM   #3
s.arzandeh
LQ Newbie
 
Registered: Jul 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
which library do u think is missing?
i can attach my cpp file if u want.
 
Old 07-17-2013, 03:18 AM   #4
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
I can't tell. It can be anything, or even an overlooked object file from the program. You will have to try searching the code for it, or search the documentation on the object it is part of.
 
Old 07-17-2013, 03:45 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
do you have other files in that dir? how your makefile looks like?
 
Old 07-17-2013, 04:42 AM   #6
s.arzandeh
LQ Newbie
 
Registered: Jul 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
Buddy.cpp , Buddy.h and Buddy_packet.h
these 3 files are located in a folder named Buddy ns-allinone-2.30/ns-2.30/Buddy
here is my Makefile
Makefile.txt
 
Old 07-17-2013, 04:53 AM   #7
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
As I said, I can't tell.

It could even be a coding error leaving out the function.
 
Old 07-17-2013, 05:01 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
Yes, probably you modified Buddy.cpp, or you have a strange/unexpected environment/macro? Hard to tell... You can try to post that file too...
 
Old 07-17-2013, 06:11 AM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2016, Slack14.1 Deb Jessie, + 50+ other Linux OS, for test only.
Posts: 16,276

Rep: Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153Reputation: 3153
# 1 .
Quote:
Buddy.cc.text._ZN10BuddyClass6createEiPKPKc[BuddyClass::create(int, char const* const*)]+0x1d): undefined reference to `Buddy::Buddy()'
collect2: ld returned 1 exit status
Could be the 400 other objects.o were compiled with a different g++ version ?

Looks like a very common ns2 link time error.

Which compiler did you use for ns-allinone-2.30 ?


-
 
Old 07-18-2013, 01:40 PM   #10
s.arzandeh
LQ Newbie
 
Registered: Jul 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
@pan64 Dear I send Buddy.cpp file in link below. is it possible to have look?
http://www.linuxquestions.org/questi...866/page2.html (in #22)
thanks
 
Old 07-18-2013, 05:18 PM   #11
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,600

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
I see no function declaration for "Buddy()".

The closest I see is a HDR_Buddy() which looks like a macro definition.
 
1 members found this post helpful.
Old 07-19-2013, 03:48 AM   #12
s.arzandeh
LQ Newbie
 
Registered: Jul 2013
Posts: 23

Original Poster
Rep: Reputation: Disabled
@jpollard thanks yes Buddy() was missing
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] make: *** [.obj/matrix.o] Error ifonly Linux - Newbie 16 01-17-2012 06:04 AM
[SOLVED] gcc recompiles c file (obj file in different location) freeindy Programming 2 07-11-2011 04:45 AM
[SOLVED] C++ - Two-way Communication between objects if A (obj) creates an instance of B (obj) Gavin Harper Programming 5 04-06-2011 06:27 AM
make with make file yields error: /usr/bin/javac: cannot execute binary file bweaver Ubuntu 4 11-19-2010 03:58 PM
C/CPP: question about a strange way to make a obj array. RHLinuxGUY Programming 3 10-27-2007 09:47 AM


All times are GMT -5. The time now is 02:12 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration