I have the following objective-c snippet in my welcome example:
//hello.m #import <Foundation/Foundation.h> #import "hello.h" void sayHello() { #ifdef FRENCH NSString *helloWorld = @"Bonjour Monde!\n"; #else NSString *helloWorld = @"Hello World\n"; #endif printf("%s", [helloWorld UTF8String]); } //main.m #import <Foundation/Foundation.h> #import "hello.h" int main (int argc, const char * argv[]) { sayHello(); return 0; }
Creating this stuff in osx works fine and works as expected. But when compiling / linking it to ubuntu (using GNUStep), a segmentation error occurs when executing the binary. I nailed it to the casting operation in the printf statement, but I donβt know what I am doing wrong here or how I can solve it.
Interesting note: this works great when using the gcc toolchain to create an executable. I just see this problem creating it with clang on ubuntu.
Any help is greatly appreciated.
objective-c gnustep
Rene Groeschke Jan 20 '14 at 19:30 2014-01-20 19:30
source share