Hi how do you go about including two or more .cpp files in visual express 2008?Have no problem including headers but cant seem to fathom including extra .cpp files.Tried to find it on msdn but just ended up going around in circles....
Hi how do you go about including two or more .cpp files in visual express 2008?Have no problem including headers but cant seem to fathom including extra .cpp files.Tried to find it on msdn but just ended up going around in circles....
Why do you need to include .cpp files? The one special case I can think of when you would include a source file is to include it in a header file where templates are defined.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I think he is asking how to add new .cpp files to a project in the IDE. I've never used VS 2008, but can't you just add a generic file and name it with a .cpp extension?
Yeah sorry didnt make myself clear.
At the moment I have
main.cpp
main.h(function prototype's)
playerClass.h(my structs and class's)
and I want to include a playerClass.cpp with the structs and classes are initialised.I have being doing that in main.cpp but it is starting to get unwieldy.
I have added an extra .cpp file in the manager project(as a source file) but when I go to compile it gives errors that the varibles are un-declared
So what can go in the .cpp file then?
Will just keep using one cpp file and the headers.Not worth the head ache.And its not as If im programming Microsoft Office suite 2009 or half life 3
Thanks to all
If you're use to other compilers like codeblocks or devcpp where you can include a header file with the prototypes AND the functions then yea visual studio 2008 can be confusing. I know it was for me at first.
For my projects I use .cpp files for the function 'code' and the .h header files for prototyping the functions. That way VS doesn't complain about having undefined variables/functions. Just include the header file in the main.cpp. So basically in the end you should have;
-main.cpp
-main.h
-playerClass.cpp // all the functions
-playerClass.h //all the function prototypes
Got ye.I think i was trying the impossible