Header file problem
Hi, I have 2 cpp files, each one including the test.h header file.
my header file seems like this:
The problem is that the linker says
'int test (?test@@3HA) already defined in test.obj'
'char *hello (?hello@@3HA) already defined in test.obj'
Ive tried pragma once, but the above, shouldnt fix the problem??
It doesnt.. :(
Please help, thanks!
try manually deleting the obj file
without seeing more of your code I would be suspicious of a name clash.
Name clash? Meaning?
The rest of my code are 2 cpp files including the same header.
Oh, if I delete the obj file, it works! but isnt there an automated way??
force the compiler to recompile all. don't remember how right now to tired. Lazy compilers *sigh*
Ohh yes!! works! Thank you man, you saved my life :))
Oups, no, it didnt work.. Sorry, my mistake, i forgot to include the header file 2nd time.. still the same error..
post the files so I can see what they look like to determine what the problem is...
The mistake is: u DEFINE a variable in a header. Remember: always DECLARE but not DEFINE variables in header file.
to a cpp file; And write in header file like this:
extern int test;