Function Definitions

Hello again.

I'm having trouble compiling my dice Project, and I haven't been able to figure out why the functions drawDice and rollDice are throwing me LNK 2019 errors when attempting to build.

Here are the github links to the full code:

Functions are declared on fProtoType.hpp
http://github.com/lmwunder/Fishy-Dice/blob/master/submoduleDieProb/fProtoType.hpp

Functions in question are defined at iDieFunct.cpp
http://github.com/lmwunder/Fishy-Dice/blob/master/submoduleDieProb/iDieFunct.cpp

They are used here at playGame.cpp
https://github.com/lmwunder/Fishy-Dice/blob/master/submoduleDieProb/playGame.cpp

Must be a problem with your Visual Studio setup.

Using g++ I get one error:
progConfig.hpp:72:53: error: qualifiers can only be specified for objects and functions
const enum DieType { RED_DIE, YELLOW_DIE, GREEN_DIE };

Remove "const" and it compiles.

clang++ compiles it as is with warnings.
Removing the const did not fix the ultimate problem, wherever it may be.


1>playGame.obj : error LNK2019: unresolved external symbol "class Dice __cdecl drawDice(int * const,int)" (?drawDice@@YA?AVDice@@QAHH@Z) referenced in function "void __cdecl playGame(void)" (?playGame@@YAXXZ)
1>playGame.obj : error LNK2019: unresolved external symbol "int __cdecl rollDice(class Dice)" (?rollDice@@YAHVDice@@@Z) referenced in function "void __cdecl playGame(void)" (?playGame@@YAXXZ)


I did update the changes I've made since my last post to the repository. Commenting out the two troublesome functions returned in the linker errors obviously made it "build-able" ( without the const removal )

I think it may be a problem with my Project Configuration, but don't know exactly what I touched. I was probably foolishly messing around with optimizations. So I'm left with two questions:

1. Is there a single setting that allows me to reset all of my project settings to their defaults in Visual Studio 2012 Update 4?

2. Should I rewrite my function definitions so that they're all in one file? Or can I leave them separated as is ( which I think is a better idea ).

I might try deleting all of the .obj files.

If that didn't work I would copy/paste the code out of the project, and then delete the project and make a new one. Then copy/paste/add the files into the new project.
Sometimes, you just gotta nuke everything and start clean.

I followed the advice of LowestOne and simply created a new project and started over.

And it built. Thanks!
Rereading my post, I didn't mean to imply that removing "const" would solve your problems. I should have typed "If I remove "const" it compiles". That is with g++.




Edit: had this open in a tab and missed the above posts.
Last edited on
Topic archived. No new replies allowed.