LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2006, 02:33 PM   #1
ghborrmann
Member
 
Registered: May 2004
Location: Louisville KY
Distribution: Fedora 25
Posts: 32

Rep: Reputation: 0
gcc linker error - malloc_alloc_template


I'm trying to compile a program using std::list, using a command line:
gcc myprog.cpp
and get the following error messages from the linker:

Quote:
/tmp/ccK55ZP7.o: In function `__malloc_alloc_template<0>::_S_oom_malloc(unsigned int)':
/tmp/ccK55ZP7.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x1a): undefined reference to `endl(ostream &)'
/tmp/ccK55ZP7.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x27): undefined reference to `cerr'
/tmp/ccK55ZP7.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x2c): undefined reference to `ostream:perator<<(char const *)'
/tmp/ccK55ZP7.o(.__malloc_alloc_template<0>::gnu.linkonce.t._S_oom_malloc(unsigned int)+0x37): undefined reference to `ostream:perator<<(ostream &(*)(ostream &))'
collect2: ld returned 1 exit status
I'm using Red Hat 7.3, if it makes any difference. I know I've used STL containers in the past with no problems; what's wrong here?
 
Old 07-31-2006, 03:08 PM   #2
tuxdev
Senior Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012

Rep: Reputation: 115Reputation: 115
Post code please. I think by looking at the errors that you are missing the std:: scoping of the STL stuff. The evils of newbie books doing "using namespace std" strikes again!
 
Old 07-31-2006, 03:22 PM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Seeing as it's C++ you may also want to try "g++"
 
Old 07-31-2006, 10:15 PM   #4
ghborrmann
Member
 
Registered: May 2004
Location: Louisville KY
Distribution: Fedora 25
Posts: 32

Original Poster
Rep: Reputation: 0
Quote:
Seeing as it's C++ you may also want to try "g++"
Thanks for your suggestion. I tried g++ and it worked perfectly.

Quote:
Post code please. I think by looking at the errors that you are missing the std:: scoping of the STL stuff. The evils of newbie books doing "using namespace std" strikes again!
Thanks for your reply. No, I am not "using namespace std": I use std::list<MyClass> and std::list<MyClass>::const_iterator, and use only the default constructor and the push_front member functions. It appears to me that there is a missing library, but I can't figure out why the default libraries are not sufficient. As noted above, g++ apparently has no problem with the code, so my immediate problem is solved.
 
  


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
autotools/gcc linker issue fibbi Linux - Software 2 05-08-2006 10:38 PM
gcc Linker error - please help! Liche Programming 5 09-26-2005 07:14 AM
the linker is not working (gcc ) abd_bela Ubuntu 1 09-13-2005 03:51 PM
gcc linker question alenD Programming 2 08-01-2005 09:31 PM
Linker Error dim79 Programming 2 06-28-2003 09:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:52 AM.

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