When I compile a C++ project in eclipse it shows me errors saying that all functions in IO.cpp are already defined.
This is my code:
File: IO.cpp
#include <string>
#include <iostream>
using namespace std;
void print(string line) {
cout << line;
}
void println(string line) {
cout << line << endl;
}
void printError(string message, string error, string file) {
cout << "An error occurred!" << endl;
cout << "Message: "+ message << endl;
cout << "Error: "+ error << endl;
if(file != "") {
cout << "File/Method: "+ file << endl;
}
}
File: main.cpp
#include <string>
#include <iostream>
#include "IO.cpp"
using namespace std;
int main()
{
println("Hello world!");
}