Noobish C++ question

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Stoo
Posts: 42
Joined: 2012-05-11, 00:28

Noobish C++ question

Postby Stoo » 2012-05-17, 03:57

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?
User avatar
Carsten
Site Admin
Posts: 2006
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Noobish C++ question

Postby Carsten » 2012-05-17, 09:50

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.
Best regards,
Carsten
Stoo
Posts: 42
Joined: 2012-05-11, 00:28

Re: Noobish C++ question

Postby Stoo » 2012-05-18, 00:16

: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!
User avatar
Carsten
Site Admin
Posts: 2006
Joined: 2004-08-19, 13:46
Location: Germany
Contact:

Re: Noobish C++ question

Postby Carsten » 2012-05-18, 00:20

You mean this one?
:wallb:

Good to hear you found the problem!
:cheesy:
Best regards,
Carsten
Stoo
Posts: 42
Joined: 2012-05-11, 00:28

Re: Noobish C++ question

Postby Stoo » 2012-05-18, 04:56

: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

Return to “Coding and Scripting”

Who is online

Users browsing this forum: No registered users and 2 guests