User forums > Using Code::Blocks

Need help with code block and Objective C

(1/1)

newcoder:
I am very new to this and need some help.  I want to use Code Block to write code and compile using Objective C.  I am using windows xp. I have the mingw compiler installed along with the objective c addins.  I can compile from a command line and all this is working fine, example 'program.m -o program -l objc.' I want to be able to do everything within an IDE. I downloaded Code Block today but am confused on how to set everything up so that I can create or add in my source.m code and have it compile using the compile command within Code Block.  Please any help will be greatly appreciated. 

thomas:
Look here: http://wiki.codeblocks.org/index.php?title=Installing_Fortran_Compiler

It should be 99% the same for Objective-C

newcoder:
I just tried using the fortran model suggested.  If my source is mycode.c it works okay but if i change it to a mycode.m following the directions I get a link error.  In the adlink I added -lobjc. The link error really makes no sense to me as I selected gcc.exe and not ming32++.exe for both c and link steps as the error message says.  I created a different model and called it objectiveC, set parameters as suggested, and I get this error message:

Linking console executable: C:\Documents and Settings\Ron\mysrc\console.exe
mingw32-g++.exe: .objs\pro2.5.o: No such file or directory
mingw32-g++.exe: no input files
Process terminated with status 1 (0 minutes, 0 seconds)


0 errors, 0 warnings

The same program compiles fine using the command line:
'gcc pro.m -o pro -l objc'

Any advise is appreciated :P


newcoder:
PS / Further this is very simple code I am just trying out to get the compiler/IDE to work and the code is:

#import <stdio.h>

int main (int argc, const char *argv[])

{

int value1, value2, sum;

v1 = 50;
v2 = 25;
sum = value1 + value2;

printf ("The sum of %i and %i is %i\n", v1, v2, sum);

return 0;
}

Navigation

[0] Message Index

Go to full version