Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Separating C++ source program into separate files

$
0
0
I have built a fairly complex VS C++ program which works perfectly. My problem is that the single source file is fairly long and, since I am planning to add further features, it would be convenient to separate it into more than one .cpp file. I guess I just don't know the correct procedure for doing this. I wrote a .h file that has all the class definitions etc. in it, but when I break up my source file into, say, two .cpp files and#include the header file in each, the compiler complains about multiple definitions; if I don't#include it, the compiler says it doesn't know what I am talking about. I understand both complaints but don't know how to get out of this situation. I would appreciate some help.

gabriel weinreich


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>