User forums > Using Code::Blocks

Compiling Objective-C - A Short Guide

<< < (2/5) > >>

killerbot:
but the compiler itself can be supported. CB supports nicely different compilers. I use to have projects where each target (total 7 targets) was building the same sources but with a different compiler.

oBFusCATed:
Yes, but this is done in a hacky way...
You have to make the compiler look like a C/C++ compiler...

Something should be done to make it more native for other compilers...

x-code:
Adding Code:: Blocks support ObjC and Go languages would be very helpful. Indeed, support of D language is present and D is not even part of gcc, as opposed to ObjC and, more recently, Go.
I think that is enough to start a minimum of support: add project types "ObjC Project" ("Go Project", "Fortran Project", "Ada Project" etc.), and a simple syntax highlighting.

Justin Brimm:
Created a new page on the wiki: Installing Objective-C Compiler

I don't like half-***ing things, so I took the time to expand on a few more things and made the page properly formatted and sectioned, instead of just copy and pasting my post into the wiki page. Hopefully this helps people out.

By the way, Objective-C is a strict superset of C, so it actually uses the standard GCC C compiler; all the magic is actually done by the ObjC library. When you compile, the C compiler uses the library to convert all ObjC functionality into strict C. Methods are all converted into C functions, and things like classes are simply used by the compiler to properly name and optimize the instance variables and functions. The compiler and library also handle the low-level memory management for classes, so creating or destroying a class properly creates and releases blocks of memory that can store all the information defined in that class.

Because ObjC uses the standard GCC C compiler, C::B really shouldn't need much in the way of hacks to natively support Objective-C compiling. All C::B really needs beyond a default GCC Objective-C Compiler setup and Objective-C project type, is proper support for Objective-C filetypes. By default, C::B won't compile or link new source files until you change their settings, and it defaults the compiler variable for all sources and headers to CPP, when they need to be CC. I think this is because ObjC sources are *.m and C::B confuses them with C++ sources.

Justin Brimm:
Modified the wiki page!

* Added troubleshooting section and information on how to resolve some poorly documented errors I've run into myself.
* Updated the list of keywords for syntax highlighting.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version