Dragonfly Q&A

String syntax in function calls

0 like 0 dislike

I've tried everything I can think of to debug this, including referencing Sprite code and googling the error.  It might just be in my function call syntax, but creating a Map object within GameStart.cpp gave the same error with it.

What I'm trying to do is simply set up reading from a file: I have the ifstream related code compiling, but I've been unable to call the function.

Relevant lines of Map.cpp:

  string str = "map1.txt";
int loadMap(string filename){

Error message: Map.cpp:(.text+0x5bb): undefined reference to `Map::loadMap(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

asked Oct 8, 2014 in Game Development by jbardonjr

1 Answer

0 like 0 dislike

It looks like you are missing the "Map::" in front of loadMap().  i.e.,

int Map::loadMap(string filename) {


Is that it?  BTW, this is common bug 5.2.7 in the book (v2).

answered Oct 8, 2014 by claypool
It's always the simple things.  That was it.
More information about Dragonfly can be found on the Dragonfly Home Page.