Okay so I'm currently starting to work in SFML and I'm looking at making my first engine after studying a few other game engines I've seen. So basically right now I have a "gamestate" class then another class for levels. I'm trying to pass a string to the other class so I can change what the window title says to get an idea of how things work.. so I will show you an example.
I'm getting the following errors:Code:#include <string> #include <iostream> Class A { public: void function(std::string); }; void A::function(std::string Name) { std::cout<< Name; } int main() { A a; a.function("string to window"); }
I see that its trying to pass it is trying to pass it as a character array which obviously wont work, but how do i go about it.. do i need to typecast or something??Code:/home/cody/Documents/GameEngine/src/GameState.cpp||In member function ‘void GameState::Run()’:| /home/cody/Documents/GameEngine/src/GameState.cpp|18|error: no matching function for call to ‘Engine::Run(const char [7])’| /home/cody/Documents/GameEngine/include/Engine.h|20|note: candidates are: void Engine::Run()| ||=== Build finished: 1 errors, 0 warnings ===|
thanks guys,
Also.. not the appropriate forum but with things like image loading is it necessary to have a class?? I feel simply using functions would be easier. Thanks



LinkBack URL
About LinkBacks



