Warm tip: This article is reproduced from serverfault.com, please click

Debugging c++ .cpp file using Xcode

发布于 2011-09-07 21:41:39

I have a solitary .cpp file, and I would very much like to debug it.

Without creating an Xcode project, is there anyway I can debug this using the Xcode debugger?

When I open the file in Xcode to edit and set breakpoints, the program doesn't stop at the break points.

Questioner
wfbarksdale
Viewed
0
Jorge Leitao 2011-09-08 08:36:50

You can't debug via Xcode without a project because without a project, Xcode works only as a file editor with color highlight and so one.

For debugging you need an executable compiled with debug option, which is produced via a compiler. The easy way (but in my opinion the worse) is to make a Xcode project and put the .cpp file there. There is the hard way too (and probably the best for future reference) that is to learn to do it on the terminal, using for instance the g++ (compiler) and gdb (debugger).