Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to combine the .cpp and .h files for compile and run?

Status
Not open for further replies.
insert the files into your project. I dont know if this is what you were looking for or not. It was a bit vague

Matt
 
Thx in advance.
The problem is, I have tried but failed to put the .cpp and .h files all into a project in VC++ for compilation.
Thx=>
 
Do you have a main program? I create a main program (to test my individual .cpp files), just go to set up a new project. Create a new Win32 console application ("Hello World" works as a good template). From there, you put an include statement in your code like:

#include "c:\dir\dir\...\myfile.cpp"

and when you compile, it will compile the file you included. The included file you are trying to compile should have an include:

#include "c:\.....\myfile.h"

I don't know if that is what your problem is, but that's what I did to solve a problem of compiling and testing my .cpp files.


 
To add files that were created outside of the current project, to the current project...
Switch from the class view to the file view in the workspace.
Now, select the project that you would like to add the files too.
Right Click on the project, and select "Add Files To Project".
Select the files (via file open dialog that appears) and click OK.
The files are then in the project and will be compiled whenever the project is built.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top