Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Keep getting errors in Xcode!!!!! (http://www.mac-forums.com/forums/os-x-development-darwin/298416-keep-getting-errors-xcode.html)

miltonian 04-28-2013 01:48 AM

Keep getting errors in Xcode!!!!!
 
I have read 3 different tutorials for learning objective c and c and I keep getting the same error messages in the terminal! The errors include: error: stray \37 in program and error: stray \377 in program... And many, many more

Here is one of the codes that I COPY AND PASTED from a tutorial:

#include <stdio.h>
int main() {
printf ("Hello World\n");
return 0;
}

PLEASE help me figure out the problem.

Raz0rEdge 04-28-2013 09:52 AM

I'm using Xcode 4.6.2 and this is how you start a project for a C application.

File->New Project. Under OS X->Application->Command Line Tool. Hit Next and then choose a name for your program, ensure that the Type is set to C and then hit Next and Finish once you've chosen where yo save the project.

You will now to put into the project explorer and have the main.c and <projectname>.1 files. The first is your source file, of course, and the second is the MAN(ual) page for your program. The reason the MAN page was created is because we choose the Command Line Tool project.

As it turns out, the sample C-code that gets created for you is the basic Hello World program you are showing. Build your project with CMD+b and run with CMD+r, you will now see a All Output window appear on the bottom with the window where you'll see "Hello World" appear.


All times are GMT -4. The time now is 02:35 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.