3

ok i have this program here:

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSLog (@"Hello world!");
    [pool drain];
    return 0;
}

the problem is when i compile it with the command "gcc -framework Foundation prog1.m -o prog1"

i get this: "gcc: error trying to exec 'cclobj' : execvp: No such file or Directory"

do i need to install any packages?? "

2 Answers 2

5

Its not the only way but GNUStep worked for me. For a good writeup on setting it up look here.

Note: Your exact error is listed about halfway down that page. Your missing package seems to be 'gobjc'.

Sign up to request clarification or add additional context in comments.

2 Comments

ok i did what u said the only problem is, that , when i compile using this command "gcc -framework Foundation prog1.m -o prog1" i get the same error. But when i write "#import <Foundation/Foundation.h>" on top of the file prog1.m and then compile it like this "gcc gnustep-config --objc-flags -lgnustep-base prog1.m -o hello" it works fine. what is the correct way to do it? help pls.
The way I understand it you should always use '#import' to load the frameworks just like you would '#include' in c++. The need to pass the frameworks in the command line depends on the tool you're using to compile and weather or not it needs the instruction or if it can determine the dependencies on its own.
3

You need to install "gobjc"

Example

gcc -x objective-c -o

check this link Compiling Objective-C using the gcc

http://webcache.googleusercontent.com/search?q=cache:iIgkFc-JoRYJ:https://www.cs.indiana.edu/classes/c304/ObjCompile.html+http://www.it.uc3m.es/mibanez/lao/lab1/tutorial3/ObjCompile.html&cd=1&hl=en&ct=clnk&client=safari

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.