I keep getting this duplicate error, and I am pretty sure nothing is duplicated here. I have a main.cpp and print.cpp in my source directory. The main.cpp looks like this:
#include <iostream>
#include "print.cpp"
using namespace std;
int main () {
// insert code here...
print();
return 0;
}
and the print.cpp is:
#include <iostream>
using namespace std;
void print()
{
cout << "no duplicate" <<endl;
}
It gives me an error of duplicate symbol print(). On the other hand, if i just get rid of the whole print.cpp, by making it blank (with /* and */), then it actually works. What is going on here??
#include <iostream>
#include "print.cpp"
using namespace std;
int main () {
// insert code here...
print();
return 0;
}
and the print.cpp is:
#include <iostream>
using namespace std;
void print()
{
cout << "no duplicate" <<endl;
}
It gives me an error of duplicate symbol print(). On the other hand, if i just get rid of the whole print.cpp, by making it blank (with /* and */), then it actually works. What is going on here??