Malloc
Malloc

Reputation: 16276

error compiling Objective-C class : Id returned 1 exit status

i tried to compile my first class in Objective-C (Personne.m) and i got the following errors :

undefined reference to WinMain@16
Id returned 1 exit status

i know that this question was asked before but i still didn`t know how to fix it. THX in advance :)

Upvotes: 0

Views: 449

Answers (1)

Carl Norum
Carl Norum

Reputation: 224944

If you don't have a WinMain function in that file, you probably want to add -c to your command line:

gcc -c -o className.o className.m

Then later, when you're linking together your object files into the final executable, you can leave the -c off. Just make sure one of your object files has WinMain in it or that you link against whatever system library is supposed to contain it:

gcc -o myApp className.o className2.o ... WinMainLib.a

Upvotes: 1

Related Questions