Visual Studio 2008 - .h and .cpp files

Hi guys,

I have a very basic question. I have been using DevC++ for some months in order to learn C++ basics . Now I have to switch to VS2008, and I am completely lost... for example, let us assume that your FUNCTION.cpp file defines a function which prototype is in FUNCTION.h
Using DevC++, I just have to save them in the same directory, and I can build and run my FUNCTION.cpp.
In VS2008, I create a new Win32 empty project and then I add to it FUNCTION.cpp and FUNCTION.h . When I try to build the project, I get errors (Non resolved external link).
My basic question is "How can I create a project basing on existing files?" Sorry if my language is not appropriate, but I am a complete beginner...

Many Thanks
Start an empty project like you did, then just go into the Header Files section in the Project Explorer and select "Existing File" then find your .h(pp) file. Then do the same for your Source Files, except get your .cpp files.
Many thanks, now I fixed this. But there is stilll something quite not clear to me. Let's say that I have FUNCTION1.h, FUNCTION2.h (prototypes) and FUNCTION1.cpp FUNCTION2.cpp (definitions), and my Main.cpp includes both FUNCTION1.cpp FUNCTION2.cpp.
I add Main.cpp to my Source Files, then I try to build.
VS2008 displays an error message saying that while building Main.cpp, can't open FUNCTION1.h, FUNCTION2.h (such files or dir do not exist).
Why?
Sorry, just fixed this as well, many thanks!
Topic archived. No new replies allowed.