views:

109

answers:

1

Howdy!

I am trying to load my xcode project into textmate so that I can compile and run using the xcode bundle in textmate.

When I compile my project in XCode it works fine, but when I load it up into textmate and I try to compile and run using the XCode bundle I get C99 errors due to my for loop syntax.

Has anyone run into this situation before? My XCode project is of the "Command Line Tool" template and I selected the "C++ stdc++" type for the project.

EDIT: The error I am specifically getting is:

Error: 'for' loop initial declaration used outside c99 mode

on the following line:

for(int i = 0; i < value; i++){

Again, I am only getting that error when I tell the TextMate XCode bundle to build and run, but it works just fine if I load up the project in XCode. I am also referencing the OpenCL framework as well in the XCode project, but I'm not sure how that would cause something like this to occur.

Thanks!

+1  A: 

You need to set your C dialect to C99, which is an update to the language, standardized in 1999, with slight differences from "ANSI C."

In Xcode:

  1. Select either your project or target (whichever you deem appropriate for this setting change.)
  2. Open the File menu and select Get Info.
  3. Select the Build tab in the window that appears.
  4. Find the "C Language Dialect" option and set it to C99.
  5. Recompile.
Jonathan Grynspan