By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,910 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,910 IT Pros & Developers. It's quick & easy.

undefined reference to "operator new" and "operator delete"

100+
P: 365
I compiled tinyxml files (.cpp files) and when I am linking to create final exe in Linux, I am getting lot of errors saying "undefiend reference" to "operator new" and "delete", any idea?.


Main.cpp:377: undefined reference to `operator delete[](void*)'
tinyXML/include/tinystr.h:259: undefined reference to `operator delete[](void*)'
../common/tinyXML/include/tinyxml.h:1401: undefined reference to `operator delete[](void*)'
../common/tinyXML/include/tinystr.h:259: undefined reference to `operator delete[](void*)'
/opt/lib/libtinyxml.a(tinystr.o)(.text+0x83):tinyXML/tinystr.h:242: undefined reference to `operator new[](unsigned)'

/opt/lib/libtinyxml.a(tinystr.o)(.text+0xb7):tinyXML/tinystr.h:259: undefined reference to `operator delete[](void*)'

/opt/lib/libtinyxml.a(tinystr.o)(.text+0x14f):tinyXML/tinystr.h:242: undefined reference to `operator new[](unsigned)'
/opt/lib/libtinyxml.a(tinystr.o)(.text+0x19a):tinyXML/tinystr.h:259: undefined reference to `operator delete[](void*)'
Dec 1 '09 #1
Share this Question
Share on Google+
3 Replies


100+
P: 542
I don`t know anything about linux but it sounds as though you are missing the include file which defines the new and delete operators, like #include<iostream> in the environment I work in. I`ll be interested to see what the experts say.
Dec 2 '09 #2

100+
P: 365
I did include #include <iostream> in all .cpp files, but it didn't help, any other clue?.
Dec 2 '09 #3

100+
P: 365
Found the issue: I need to pass -lstdc++ during linking, those errors gone, couple of more for shared libs.
Dec 2 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.