Reputation: 529
I don't quite understand the entirety of the situation that could have led to this, I made quite a large amount of changes to this function, but it seems that this isn't a function issue rather than an issue in the function calling this function.
main(){
//set up variables...
//theVector is made on the spot using a constructor
Player thePlayer(proper, variables, here);
Map theMap();
theMap.functionThatAddsValues(stuff);
std::map<ObjectName, Drawing> theMap;
//This map is filled by using theMap[ObjectName::TheObject] since
//this is mapped by its first values being enumerated data.
movement(theVector, thePlayer, theMap, theDrawings);
//other stuff
}
void movement(sf::Vector2f theVector, Player thePlayer, Map theMap, std::map<ObjectName, Drawing> theDrawings){
//use the joyous variables
}
If this information is too vague, I can do a code dump link later of the file, I just think the code is too big to post here in its entirety since it has both functions and lines of codes that I plan on removing due to deprecation, and functions that aren't finished yet (as shown by the errors).
Edit: Forgot to mention the error:
/home/sir-lulzalot/Testland/sfml/SFMLink/main.cpp:277: error:
undefined reference to `movement(sf::Vector2<float>, Player, Map, std::map<ObjectName,
Drawing, std::less<ObjectName>, std::allocator<std::pair<ObjectName const, Drawing> > >)'
Edit2: Here's a dump of the main.cpp http://pastebin.com/TyCzWyfK
Edit3: Derp found answer.
Upvotes: 0
Views: 54
Reputation: 12435
That's a linker error.
You don't have consistent declarations and definitions.
This is the declaration of the movement function at the top of the file:
void movement(sf::Vector2f, Player, Map, std::map<ObjectName, Drawing>);
This is the definition of the movement function:
void movement(sf::Vector2f theVector, Player &thePlayer, Map &theMap, std::map<ObjectName, Drawing> theDrawings){
Notice that the definition takes a Player&
, while the declaration says Player
.
Upvotes: 1
Reputation: 6260
For a start, this line probably doesn't do what you think it does:
Map theMap();
This declares a parameter-less function named theMap
which returns a Map
. (see here for the reason why). I'm guessing you probably intended to create a variable named theMap
of type Map
, in which case you need to remove the parentheses.
You then use the same name (theMap
) for a variable of type std::map<ObjectName, Drawing>
. I'm going to hazard another guess and say that you meant for this variable to be called theDrawing
.
Beyond that, you haven't shown the code for variables theVector
or theDrawings
, so if you want more answers, I suggest you put together a SSCCE. Or in other words, do not leave out any code which is necessary for generating the error.
Upvotes: 3