Hi all, I'm just trying to do something very simple with C++. Instead of writing my code in one large file, I want to break it up into multiple files. Let's say I have two files, file1.cpp and file2.cpp. This is file1.cpp:
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
using namespace std;
#include "file2.cpp"
int main()
{
return 0;
}
So what do I need to put at the top of file2? How can I make sure file1 is compiled and executed first? The compiler is giving me like 20 errors regarding File2, which is actually flawless. It seems it cannot find the #include lines from file1. How can I correct this? You can tell me the answer in dev c++ or Microsoft VC++. I will use whichever one I can figure this out in. Got a huge project due soon, Thanks for any help!!
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
using namespace std;
#include "file2.cpp"
int main()
{
return 0;
}
So what do I need to put at the top of file2? How can I make sure file1 is compiled and executed first? The compiler is giving me like 20 errors regarding File2, which is actually flawless. It seems it cannot find the #include lines from file1. How can I correct this? You can tell me the answer in dev c++ or Microsoft VC++. I will use whichever one I can figure this out in. Got a huge project due soon, Thanks for any help!!