There has been some trouble with the -lobjc flag trying to link to, which has been a nonfunctional shared library for some time. Many of these issues are likely solved in this newest release. There is currently no 4.6.x port of GCC for TDM-GCC/MinGW available the GCC 4.6.x branch introduces an entirely new Objective-C library that brings the ObjC implementation inline with Apple's own implementation of the library. This section tries to identify and solve the currently identified issues note that these are issues as of the current GCC 4.5.x branch, unless otherwise noted. There's a small handful of pitfalls you can fall into when attempting to compile Objective-C applications using TDM-GCC or MinGW, and these pitfalls are unfortunately not well documented. You don't need to do anything else to it. This will automatically get selected when you change the other options and if you close the dialog before you uncheck it, you'll have to go back and change it, then close and reopen the file in the viewer before you can edit it.Ģ) When you add a header file ( *.h), you'll also need to open up its properties window and change the compiler variable to CC. Before you close the dialog, go to General and uncheck File is read-only. Under Build, select both Compile file and Link file. Under advanced, change the compiler variable to CC. Whenever you add or create a new ObjC source ( *.m) in your project, you must right-click on it and go to Properties. For reasons beyond my understanding, GCC will sometimes (albeit rarely) complain during complex builds if this isn't the last argument on the line.ġ) By default, C::B will select CPP as the default compiler variable for a new source file, and the file will not be compiled or linked to a target. For Link object files to executable and Link object files to console executable, move -o $exe_output to the end of the macros.
If ObjC still refuses to build properly for you, you can use this to compare the command line arguments C::B uses against the commands you would use if you were building the program manually on the command line.ģ) Under Other Settings, go to Advanced Options.
Optional Changesġ) Go to Settings->Compiler and dubugger.Ģ) Under Other Settings, change Compiler logging to Full command line. Note: if you feel so inclined, you could create a new custom lexer. Keywords id BOOL YES NO SEL nil NULL self
(next to Filemasks.) and create a new set (up arrow). Add *.m to the list of filetypes.ģ) Go to Keywords. This makes setting up a new compiler very simple, as we can make a copy of the standard compiler and change the linker settings.Ĭaution: Make sure your GNU GCC Compiler is properly setup before attempting to setup for Objective-Cġ) Go to Settings->Compiler and debugger.Ģ) Select GNU GCC Compiler and make a copy it name it whatever you like, but " GNU GCC Obj-C Compiler" would be the most descriptive.ģ) Under Linker Settings, add -lobjc to Other linker options you don't need to explicitly add the libobjc.a library, as the flag tells gcc to include it for us.Ģ) Select Files extension handling and add *.mģ) Go to Project->Project tree->Edit file types & categories.Ĥ) Under Sources, add *.m to the list of filetypes.Ģ) Select Syntax highlighting and go to Filemasks. Objective-C is a strict superset of C the additional functionality is obtained by linking to the Objective-C library when building using the standard GNU GCC Compiler.