0

So I've reached Chapter 6 of C++ Primer 5th edition. Section 6.1.3. covers separate compilation and compiling and linking multiple source files. It then goes on to show system prompts (e.g. $ CC factMain.cc fact.cc where $ is the system prompt and CC is compiler name) that you would use in order to produce an executable file, showing the compiler where the files are.

It then talks about compiling separately to get an object file, and then linking these to form an executable.

Now I could be wrong, but is this necessary in Xcode? The system prompts stuff and the like. When you make a project, you have a target, right? And that comes with a product, an executable. To add source files to this, don't you just right-click and add .cpp files and .h header files as necessary? Or is there something else I need to do, in a similar manner discussed in the book, to get separate compilation and linking.

Thanks in advance for all the help! =D

sepp2k
  • 363,768
  • 54
  • 674
  • 675
  • See the links in [this solution](http://stackoverflow.com/questions/21419659/how-to-run-c-from-xcode-5-02) – David Sep 11 '14 at 22:50

1 Answers1

1

I don't know XCode at all, but IDEs are usually doing it the same way. They interpret your project file into series of separate source files that get compiled separately, and then run a linker to link it. All this happens without programmer interaction (IDEs are automatizing it to help and speed up the programming), but a good programer should know that he doesn't need IDE to compile a program - he can just run the compiler directly. In short - if you use your IDE you don't need to do it - but it's whats happening underneath.

j_kubik
  • 6,062
  • 1
  • 23
  • 42