Quote:Original post by chollida1
Oh yes, I should have reminded you about the .mm extension. I always found it "hacky" that apple would compile a file based on its extension, while the whole OS does its best to sheild the user from the extention of a file.
This is standard GCC behavior but you can get around it with certain flags.
Quote:For instance i have a MessageBox.cpp that uses the windows MessageBox function if copiling for windows. I would like it to Compile for MAC using the Cocoa NSAlert.
Create a C/C++ interface for creating a message box, then create two implementation files. One will be an .mm and one will be a .cpp. You can then set up your project so that the Windows version compiles and links with the the Windows implementation and the MacOS version compiles and links with the Mac implementation. Your code calls the wrapper function. No #ifdefs necessary.