Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


str=new char[103];

This topic is 5532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to program a few simple apps in C++ under Mandrake Linux using the gcc3.2 compiler. Everything works except the new operator. How can I get it working?>

Share this post

Link to post
Share on other sites
krumms, that would only be a problem if A) his setup does not recognize standard C++ file extensions as C++ files, or, B) he is not using a standard C++ file extension. Modern versions of gcc recognize that a .cpp or .cc or .cxx, etc. files are C++ files, and should compile and link accordingly.

Of course, you should definately at least try this first, and that might tell you what the problem is.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Original post by tHiSiSbOb
yes, the error is that the new operator is "not defined"

Do you mean something like this:

/tmp/ccyZ2uXU.o(.text+0x16): In function `main'':
: undefined reference to `operator new[](unsigned)''
/tmp/ccyZ2uXU.o(.text+0x2d): In function `main'':
: undefined reference to `operator delete[](void*)''
/tmp/ccyZ2uXU.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0''

If so, krumms is right. Use g++ and not gcc. Gcc will invoke g++ to compile your code, but it won''t link with the C++ library. Either use g++ or explicitly link with libstdc++:

g++ -o progname source.cc


gcc -o progname source.cc -lstdc++

If it doesn''t help, try to provide more informations, like the exact error message.

Hope this helps.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!