Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linking c++ sources in iPhone project

Tags:

c++

iphone

linker

I have a single cpp file added to my iPhone project with a .cpp extension, but I'm seeing errors when linking like:

operator new[](unsigned long)", referenced from:

___gxx_personality_sj0", referenced from:

I thought as long as I named the cpp files with .cpp or .mm it would do the right thing, do I need to add some linker flags?


1 Answers

Select the file in the project browser, and press cmd-i to bring up the info window for the file in question. Set File Type to sourcecode.cpp.cpp should do it.

Alternatively right click on your project, add new file, select C++ source, then copy and paste the content.

In light of the build log, try adding the following linker flags:

-cclib -lstdc++

This might be because gcc is being used to link, not g++.

like image 112
freespace Avatar answered Jan 31 '26 18:01

freespace



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!