Hello, I am currently in a college class for programming with Object orientated C++ and I have been stuck with constructors and classes. The assignment I have been working with needs me to split the core file into a header, core and main file. I have all three written up but there's problems with it. While in the main I seem to be unable to call a function from the class. The problem it seems for me is with the constructor. As when I had the original file It ran fine when executing the main.(it was all on one file) Now with the header and main files with a constructor in the core file, I seem to be somewhat confused in what needs to be done. Currently I have a linking error, yet if I change things a little bit. I have this error:
cit43\asteroidp roject\asteroid s.h(4) : see declaration of 'Asteroid'
yet the link error is this:
I'll post the snips of the code or if someone would like to help me figure this out(i'm not looking for a hand out, I've been working on this for two weeks troubleshooting and being stumped) I'll PM the code files, and maybe someone else with more experience can see where I'm going wrong with this.
Maybe when i solve this problem it'll help me figure out my other problem which somehow makes rand print out -8 million and something when it was specified for something else. Again any and all help and insight will be appreciated.
Code:
\cit43\asteroidproject\asteroids.cpp(6) : error C2011: 'Asteroid' : 'class' type redefinition 1> e:\
yet the link error is this:
Code:
>Asteroidmain.obj : error LNK2019: unresolved external symbol "public: void __thiscall Asteroid::displayStats(int,int,int)" (?displayStats@Asteroid@@QAEXHHH@Z) referenced in function _main 1>E:\cit43\Asteroidproject\Debug\Asteroids.exe : fatal error LNK1120: 1 unresolved externals
Maybe when i solve this problem it'll help me figure out my other problem which somehow makes rand print out -8 million and something when it was specified for something else. Again any and all help and insight will be appreciated.
Comment