LINK2019 error

When I first created the FBullCowGame header file, and later the .cpp file, I called it fBullCowGame. I noticed the different capitalization but thought it might not be a big deal but later decided to change it to what Ben had it as just in case he had that capitalization for a reason. Long story short, I renamed it and am now receiving the LINK2019 error, even though I had gotten about four lectures farther before renaming without issue.

Things I’ve tried:
Undoing the change using the undo button
Rebuilding both the solution and BullCowGame
renaming it back to fBullCowGame using ctrl + r, ctrl +r
searching the error and still not finding the cause within my own code

Text for the error:
> LNK2019 unresolved external symbol "public: __thiscall fBullCowGame::fBullCowGame(void)" (??0fBullCowGame@@QAE@XZ) referenced in function "void __cdecldynamic initializer for ‘BCgame’’(void)" (??__EBCgame@@YAXXZ)`

mind you, the only thing I changed was fBullCowGame to FBullCowGame using ctrl + r, ctrl + r

I’m sure you’ll want at least part of my code but I’m not sure where the problem is originating from so I’ll provide whatever is needed upon request

It looks like the change you made is not being read. In the error the name of the function is still using the lower case f.

Looks like you only changed the class definition and not all references. Do a ctrl + f on fBullCowGame matching case and change them to FBullCowGame.

OK I tried doing ctrl + f like you suggested, the only difference is now the error code says FBullCowGame instead of fBullCowGame. I also selected entire solution when choosing where to make the changes.

Link to your code?

main.cpp

fBullCowGame.cpp

fBullCowGame.h

Sorry for putting this in two posts, I’m a new user and can only put two links in a post right now.

Two things, you have #include "FBullCowGame.h" but by judging from your names you gave in your post, your files are still called fBullCowGame.h. Secondly you have declared a constructor for the class but haven’t got a definition for it. Since the automatically generated one should be fine for this course, you can just omit the line FBullCowGame(); // constructor in the header file.

A later video told me to put in the constructor but maybe it wasn’t supposed to work and I just hadn’t gotten far enough to know that it wouldn’t work because removing it fixed my problem, thank you.

Oh right yeah, Ben uses it to call the Reset method. So if you put that back into the header and then add this into the .cpp file you should be fine.

FBullCowGame::FBullCowGame() { Reset(); }

Privacy & Terms