Keep getting errors in Xcode!!!!!

Joined
Apr 28, 2013
Messages
2
Reaction score
0
Points
1
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

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,745
Reaction score
2,071
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
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.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top