I have code contains of Objective-C and C++. I set compiler on "Objective-C++" in "Apple LLVM 5.0 Language - Compile sources as" and now when I want to build application, it tries to compile files like CMATH and CPP_TYPE_TRAILS.H. Do you have any ideas how to figure out this problem? Thank you for answers.
Asked
Active
Viewed 673 times
0
-
1I think all you need to do is change your main.m file to main.mm http://stackoverflow.com/questions/4562255/xcode-m-vs-mm – sbarow Dec 06 '13 at 09:12
1 Answers
4
You need to change your .m file to .mm have a look on this for more info Mixing Objective-C and C++
-
Thank you for ideas but it doesn't work. I think that compiler is okey because it compile other C++ classes. When it comes to CMATH then I get error like this "Functions that differ only in their return type cannot be overloaded" – Michal Jurník Dec 06 '13 at 09:21
-
1have you #imported any cmath file in your code or used any cmath function? – Dinesh Dec 06 '13 at 09:30
-
Yes, I guess. I know about it that it compiles all classes and functions. But what I don't know why is why it gets error on standard library function/class. – Michal Jurník Dec 06 '13 at 09:35
-
1
-
1are you still getting the same error or it has changed to something else.. also do check for the #import vs #include with other standard library as well – Dinesh Dec 06 '13 at 09:54
-
Thank you for all, I've got it. But I'm not sure where the problem was. I changed .m to .mm files and change compiler then clean project and change #ifdef __cplusplus extern "C" { #endif to C++. Then restart XCode and now everything works. Thank you for being patient. – Michal Jurník Dec 06 '13 at 10:04