1 Reply Latest reply on Apr 1, 2014 1:47 PM by Fedor-Oracle

    Linking with 12.4 beta (using CC -std=c++11, unresolved symbol operator new)




      I've got our code compiling with 12.4 beta now, but linking is proving slightly different to 12.3. If I compile with "CC -std=c++11", then I get link errors:


      Undefined                       first referenced

      symbol                             in file

      operator new[](unsigned long)         foo.o

      operator new(unsigned long)           foo.o


      These can be resolved by using "-std=c++11" when linking using "CC" (a mixture of .o files and archive .a libraries), but this involves modifying many Makefiles to add this extra flag, which isn't required for the Oracle Studio C++ 12.3 compiler.


      Is this expected behaviour? Or shouldn't the compiler figure this out itself when linking?


      Many thanks,


        • 1. Re: Linking with 12.4 beta (using CC -std=c++11, unresolved symbol operator new)

          As object files created during the compilation contain references to those runtime libraries you definitely

          need to link with them in order to satisfy those references. In your case it is allocation functions.


          -std=c++11 uses a completely different ABI and a completely different set of runtime libraries compared to the default mode.


          CC -std=c++11 knows which libraries to use (and which library/run paths to set up).

          CC by default links with different set of libraries and sets up a different set of library/run paths.


          Thus you dont have any other options - you need to link with CC -std=c++11.


          Say, if you would compile the sources with g++ and then attempted to link it with Studio result would be the same.