discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error while compiling a Objective C code


From: Christopher Armstrong
Subject: Re: Error while compiling a Objective C code
Date: Fri, 23 Jan 2009 15:55:05 +1100

Hi

A couple of things:

Firstly, the programme you attached isn't really a programme - its just the interface definition for a class. You still need to add a "main()" method (like normal C) and an implementation. The error you're receiving is because your main.m lacks a main() function, which on Windows gets converted to WinMain() by the mingw runtime. If you're not familiar with Objective-C I suggest poking around the internet for tutorial.

Secondly, GNUstep's makefile system is generally the best way to compile programmes. Add file called GNUmakefile to the directory containing main.m, and put the following in it:

include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = test
test_OBJC_FILES = main.m

include $(GNUSTEP_MAKEFILES)/tool.make

You should then be able to type just "make" to compile.

Also take a look at the GNUstep Makefile manual for more details about the GNUstep makefile system (which is a little bit unique compared to other makefile systems).

Cheers
Chris

On 23/01/2009, at 3:45 PM, Gupta, Arjit (HP Labs India) wrote:

Hi,

I took the gnu set from the link http://www.gnustep.org/experience/Windows.html
and just installed it. I am attaching the program which I was compiling so just to it and please help me out if possible.
My compile command is : gcc -o main main.m

Hope this helps you to clear my doubts .

Thanks
Arjit

-----Original Message-----
From: Christopher Armstrong [mailto:carmstrong@fastmail.com.au]
Sent: Friday, January 23, 2009 3:38 AM
To: Gupta, Arjit (HP Labs India); gnustep-dev@gnu.org
Subject: Re: Gnustep-dev Digest, Vol 74, Issue 16

Hi

Could you please post:

* a copy of the source code file you were compiling
* a copy of the GNUmakefile you were using to compile with
* the command that you executed the compiler with in order to compile the program

Cheers
Chris

On 23/01/2009, at 4:01 AM, Gupta, Arjit (HP Labs India) wrote:


I have been getting an error
/mingw/lib/libmingw.a<main.o>:main.c:<.text+0xbd>:Undefined refrence
to nMain@16
Collect2 :Id returned 1 exit    status

I am not able to compile a simple objective C class main the main.

--------
Christopher Armstrong
carmstrong@fastmail.com.au





<fraction.h><fraction.m><main.m>

--------
Christopher Armstrong
carmstrong@fastmail.com.au









reply via email to

[Prev in Thread] Current Thread [Next in Thread]