I am trying to figure out why when I convert my main.m file to a main.mm file, it no longer will link properly.
I have reduces the problem to the following example code:
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
int main( int argc, const char ** argv ) {
return NSApplicationMain( argc, argv);
}
I am using gnustep and linux. I enter the following commands and everything works as expected:
g++ -g -c main.m -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers
g++ -g -o test main.o -L/usr/GNUstep/Local/Library/Libraries -L/usr/GNUstep/System/Library/Libraries -lgnustep-base -lgnustep-gui
Now if I rename main.m to main.mm and use these two commands ( same exept main.m now main.mm):
g++ -g -c main.mm -I/usr/GNUstep/Local/Library/Headers -I/usr/GNUstep/System/Library/Headers
g++ -g -o test main.o -L/usr/GNUstep/Local/Library/Libraries -L/usr/GNUstep/System/Library/Libraries -lgnustep-base -lgnustep-gui
I get the following error: main.mm:7: undefined reference to `NSApplicationMain(int, char const**)'
Can someone please find what I am doing wrong? I do not see why it is now failing to link.
I am trying to add some C++ classes to an objective c program and this is preventing me from continuing.
Thank you for any help you can provide.