I am using Micosoft Visual Studios 2010 and reached a chapter in my book that asks for seperate compiliation.

Up until now I have been using Notepad++ to write my code into a .cpp file and then used Visual Studio Command Prompt with a 'cl' command to compile the code.

I don't understand how I would compile the code from a following examples:

1) A header file with .h format
2) A source file with .cpp format that specifies the functions from the header file
3) A source file with .cpp format with the actual code of the program.

Is there a way to do this with the same Visual Studio Command Prompt? Or should I switch over and use Microsoft Visual Studios to make my programs? If so can someone please shed some light for a good tutorial on how to use it? I attempted to and was completely lost......kept complaining about std not working.

Any help is appreciated :) I couldn't find much on Google.

Recommended Answers

All 3 Replies

Let's say you have two *.cpp files -- A.cpp and B.cpp

cl A.cpp B.cpp
c. a.obj b.obj -o myprogram.exe

There are of course lots of other flags you can add but the above is the simplest.

If you bother to learn VC++ 2010's integrated IDE you wouldn't have to bother both those command prompt builds or what flags to use.

Do you know of a good guide for the intergated IDE? Thanks for the help so far btw

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.