the MS VC++ 2008 express edition compiler gives a strange linker error message:
Error 1 error LNK2005: "public: void __thiscall Class::function(int)" (?function@Class@@QAEXH@Z) already defined in class.obj main.obj
without any apparent reason. I wrote the following (simple) example to demonstrate the problem:
main.cpp:
class.cpp:Code:#include "class.cpp" int main() { Class someclass; someclass.function(10); }
it compiles fine using dev-cpp 5.0.Code:#include <iostream> using namespace std; class Class { public: void function(int); }; void Class::function(int number) { cout << "the number was: " << number << endl; cin.get(); }
sorry for my bad english...
Thanks