-
VC++ settings
I am writting a small program in VC++ 6, which has a class and a driver to test it. It compiles ok, but when I try to build it, i get 14 identical errors for each function in the class. The error is:
date.obj : error LNK2005: "public: __thiscall Date::Date(void)" (??0Date@@QAE@XZ) already defined in driver.obj
I have had a search on the net and this forum and this problem is supposed to be caused by using <iostream> instead of <iostream.h> etc, for the other headers. But i have not done that.
The program builds and runs fine in dev c++ which is why I think it may be a setting in VC++ somewhere but there are a lot of them.
Can anyone shed some light on this?
Thanks in advance
-
I don't know exactly what that means, but sometimes I get something like that if you include the same header file in two files you are linking. Try only including the iostream.h in a header file and including that in the source files. This may have something to do with it.
-
It worked, although I don't understand why. I was taught that all the standard libaries use the #ifndef pre processor directive to prevent this sort of problem.
Anyway, thanks for the help.
-
Another thing that you could try is to go try is to click Settings on the Project menu. Then click the Link tab, and click Customize in the Category box. Once you are there click the force compile option check box. This should make it so that the complier ignores the duplicate defination and just creats a possibly buggy program, but at least it outputs the program.
-JLBShecky
-