View Single Post

ZhimingWang's Avatar
Member Since: Aug 03, 2012
Posts: 22
ZhimingWang is on a distinguished road

ZhimingWang is offline
Originally Posted by Raz0rEdge View Post
What exactly does "compile without building" even mean? A quick primer on how this all works. A program can be comprised one one or multiple sources/header files..

If there is a single source file, it is first pre-processed by the compiler to evaluate all of the "#include", "#import", "#define", "#pragma" and other pre-processor directives. The file is then compiled into an object file, it is then finally linked against any necessary libraries to make it a functioning program.

The same process holds true for a project with multiple source files, you go through all the steps for each of the source files and deal with any cross-file dependencies as needed or report errors if things are messed up. Once it's all done, the final executable is created for execution.

Suppose you have a project with 3 source files, you modify one of them and then hit CMD+b, this will cause the compiler to determine which file changed, and go through the steps I described above and create the executable at that point. If you happen to do a CMD+r immediately after, the build will automatically run but since it's already up to date, nothing really happens except the message appearing and going to execute your program.

I'll have to check to see if there is a XCode option to prevent building when running, but that is usually a problem if you don't remember to build before you run.

Unless you are writing a VERY complicated program or running this on a Mac that is severely lacking in power, I can't imagine the few seconds it takes for the incremental builds or the minute it might take build the entire program is a huge deal.

I deal with building things that takes hours to complete so I know all about waiting..
Hi Ashwin,

Thank you for your really long reply

As for "compile without building", I mean the process that you compile the source file, generate the .obj file but don't link them, so no executables are generated. I mainly use this for grammatical check. (Seems that Xcode does this as I'm typing? Will that kind of check work in complex situations - I mean, will Xcode point out all errors in syntax?) I previously worked on Dev C++ on PC, and there was the option to compile, OR build. If my memory doesn't fail me, it usually takes five to six times longer to build a project than to compile it...

Anyway, I'm merely a college undergraduate and an amateur coder, so it typically take no longer than half a minute to build my projects. The waiting time becomes annoying only in the debugging process. Well, neither compiling without building nor running without rebuilding helps in debugging, though, unless I miss the bug and have to step into the same executable again...
QUOTE Thanks