Page 1 of 1

Noobish C++ question

Posted: 2012-05-17, 03:57
by Stoo
Okay, I'd hoped to get a bit further before asking for help again, but it's been too long since I did any C++ programming at all...

I'm trying to add a function to the HumanPlayer class that will just (for now) change the StateOfExistance variable. I've updated HumanPlayer.hpp with the following:

Code: Select all

...
    const btRigidBody* GetRigidBody() const { return m_RigidBody; }

    void BoardVehicle(); //  <---This is the new line

    // Implement the BaseEntityT interface.
    void TakeDamage(BaseEntityT* Entity, char Amount, const VectorT& ImpactDir);
    void ProcessConfigString(const void* ConfigData, const char* ConfigString);
...
At this point, everything still compiles and runs fine - other changes that I've made in the file take effect when they should with no issue. But when I change HumanPlayer.cpp to include the following:

Code: Select all

...

void EntHumanPlayerT::Think(float FrameTime_BAD_DONT_USE, unsigned long ServerFrameNr)
{
    ...
}

void EntHumanPlayerT::BoardVehicle() {} //  <---This is the new line

void EntHumanPlayerT::ProcessEvent(char EventID)
{
    ....
..I get the following error:

Code: Select all

g++ -o Games/DeathMatch/Code/build/linux2/g++/debug/HumanPlayer.os -c -g -funsigned-char -Wall -Werror -Wno-char-subscripts -fPIC -DDEBUG -DSCONS_BUILD_DIR=build/linux2/g++/debug -ILibs -IExtLibs -IExtLibs/bullet/src -IExtLibs/lua/src Games/DeathMatch/Code/HumanPlayer.cpp
Games/DeathMatch/Code/HumanPlayer.cpp:895:36: error: no 'void EntHumanPlayerT::BoardVehicle()' member function declared in class 'EntHumanPlayerT'
scons: *** [Games/DeathMatch/Code/build/linux2/g++/debug/HumanPlayer.os] Error 1
scons: building terminated because of errors.
Am I missing something obvious in the setup or declarations somewhere? Or should I look elsewhere for the culprit; like seeing if my editor is inserting extra characters?

Re: Noobish C++ question

Posted: 2012-05-17, 09:50
by Carsten
Hi Stoo,

I cannot see anything that's obviously wrong, but the compiler error seems to indicate a typo in one of the files, or maybe a missing or additional bracket.

I'd check for such problems first. If it doesn't help, please post the complete files e.g. at pastebin, so that we can have a look.

Re: Noobish C++ question

Posted: 2012-05-18, 00:16
by Stoo
:roll:

Looks like I'd managed to update the .hpp file in my project's directory (under Games), and the .cpp file under the Deathmatch branch - so the message was exactly right, it wasn't defined :P . I switched everything over, and now it looks like it's working fine.

Need a "smack my forehead" emoticon...

Thanks for the help!

Re: Noobish C++ question

Posted: 2012-05-18, 00:20
by Carsten
You mean this one?
:wallb:

Good to hear you found the problem!
:cheesy:

Re: Noobish C++ question

Posted: 2012-05-18, 04:56
by Stoo
:wallb:

Right... the "View more smilies" button... between missing the run directory in the instructions, this issue that started this topic, and missing that button, I'm beginning to wonder about the wisdom of jumping on this stuff right after work! :P

:wallb: :wallb:

Thanks again! :D