h's and cpp's
I''m designing a tile engine and added a .cpp and .h file into my project to store all my functions and subs. The two files are named EngineFuncs.h and EngineFuncs.h. In my main program I put #include "EngineFuncs.h" to add the files to my project. Here''s my question in the EngineFuncs.h there is no reference to EngineFuncs.cpp so how does c++ know that thats were all the code is for the function definitions in "EngineFuncs.h"????
Because your .cpp file is included in the project, so it automatically gets compiled and linked when you do a build. The only use of the .h file is so that when a .cpp file is compiled, it knows what types objects are and how functions are defined and so on, so it can compile the correct code ready for the linker to sort it all out.
Something like that anyway.
Something like that anyway.
Gee Brain, what we gonna do tonight?
Take a look at this. It should explain all you need.
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
"Finger to spiritual emptiness underlying everything." -- How a C manual referred to a "pointer to void." --Things People Said
http://www.gdarchive.net/druidgames/
I have a feeling you''re a VB programer learning C++ right? the functions and SUBS part clued me off. Anyways, when I was learning C++ I had the same question...all you have to know is that .h files just tell other files what they can use by declaring stuff. (external data, classes, functions...) and the .cpp files actually implement it. (function bodies, data...)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement