Original Post
hi people,
I have just recently decided to clean up my code in my game. I originally had all my code in header files (dont ask) and decided that I should do it all properly (class/function prototypes in headers and the code in a .cpp file)
Anyhoo after 2 hours at least of playing around with files I compile and i get 577 errors saying that function/variable/class blah blah blah already defined in something.obj.
I looked up the error (LNK2005) in the MSDN and it said that I could use the /FORCE linker option to ignore this but the program may not run as expected. Well my program runs fine with this option so my question is, would using this option be considered dodgy? Am I likely to run into trouble later on? Do i have another option?
I have spent about another 7 hours today trying to organise the headers another way so that I can avoid doing this but im not having any success, and like 7 hours with any problem, its really starting to shit me. I dont have a very good understanding on the whole C++ linker thing so if someone knows a good site that explains how c++ compiles and links code that may help me understand how to put my code together a bit better and get around this. I haven't been able to find anything all day that has helped me.
In each of the header files I have put:
#ifndef _HEADER_FILE_H
#define _HEADER_FILE_H
//header code......
#endif
but it doesn't seem to do what I thought it would (only include the header file if it hadn't been already)
I think if I knew how the linker worked I might be able to figure it out.
Thanks and sorry about the long post,
H
[edited by - klown9 on May 10, 2003 4:57:31 AM]