• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Compiling "was not declared in this scope"

Swiff

Member
Joined
Apr 6, 2009
Messages
366
Reaction score
12
Location
Sweden
Hello! I'm trying to compile the extraMagicDamage by Erikas;
http://otland.net/threads/increase-player-damage.177331/#post-1990779
But I'm getting this error:

Code:
Compiler: Default compiler
Building Makefile: "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win"
Executing make...
mingw32-make -f "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"C:/Dev-Cpp/Dev-Cpp/include" -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__CONSOLE__ -fexpensive-optimizations -O1

In file included from ../actions.cpp:23:
../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:276: error: 'extraMagicDamage' was not declared in this scope

mingw32-make: *** [obj//actions.o] Error 1

Execution terminated

What my question is.. What does "was not declared in this scope" mean?
And how would one go about to "declare"?

Edit: Sorry forgot, using:
TFS 0.3.6pl1
from: svn://svn.otland.net/public/forgottenserver/tags/0.3.6pl1

Thanks in advance!
 
Last edited:
I guess getExtraMagicDamage looks like:
uint32_t getExtraMagicDamage() const { return extraMagicDamage; }
or similar.

It means that the member uint32_t extraMagicDamage; is not declared in your Player class. You can add it in player.h under the private access modifier.
 
Code:
uint32_t getExtraMagicDamage() const {return extraMagicDamage;}
        void setPlayerExtraMagicDamage(uint32_t damage);
I alredy added these lines 276 in player.h
However I was instructed to add them in public, below the getmanaspent
I now added
Code:
uint32_t getExtraMagicDamage() const {return extraMagicDamage;}
in the private one aswell, but it gave me:
Code:
Executing  make...
mingw32-make -f "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"C:/Dev-Cpp/Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__CONSOLE__   -fexpensive-optimizations -O1

In file included from ../actions.cpp:23:
../player.h:827: error: 'uint32_t Player::getExtraMagicDamage() const' cannot be overloaded

../player.h:276: error: with 'uint32_t Player::getExtraMagicDamage() const'

../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:276: error: 'extraMagicDamage' was not declared in this scope

../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:827: error: 'extraMagicDamage' was not declared in this scope

mingw32-make: *** [obj//actions.o] Error 1

Execution terminated

Then I removed the
Code:
uint32_t getExtraMagicDamage() const {return extraMagicDamage;}
from the public and got:
Code:
Executing  make...
mingw32-make -f "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"C:/Dev-Cpp/Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__CONSOLE__   -fexpensive-optimizations -O1

In file included from ../actions.cpp:23:
../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:826: error: 'extraMagicDamage' was not declared in this scope

mingw32-make: *** [obj//actions.o] Error 1

Execution terminated

then I removed
Code:
void setPlayerExtraMagicDamage(uint32_t damage);
from public aswell and got:
Code:
Executing  make...
mingw32-make -f "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"C:/Dev-Cpp/Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__CONSOLE__   -fexpensive-optimizations -O1

In file included from ../actions.cpp:23:
../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:825: error: 'extraMagicDamage' was not declared in this scope

mingw32-make: *** [obj//actions.o] Error 1

Execution terminated

Then I added
Code:
void setPlayerExtraMagicDamage(uint32_t damage);
below the
Code:
uint32_t getExtraMagicDamage() const {return extraMagicDamage;}
in private and got:
Code:
Executing  make...
mingw32-make -f "C:\Users\Dan\Documents\The Wild\NYTFS0.3.6\dev-cpp\Makefile.win" all
g++.exe -c ../actions.cpp -o obj//actions.o -I"C:/Dev-Cpp/Dev-Cpp/include"  -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -D__CONSOLE__   -fexpensive-optimizations -O1

In file included from ../actions.cpp:23:
../player.h: In member function 'uint32_t Player::getExtraMagicDamage() const':
../player.h:825: error: 'extraMagicDamage' was not declared in this scope

mingw32-make: *** [obj//actions.o] Error 1

Execution terminated



And that's why I am confused, I declared it, atleast in one of the instances... didn't I? :S

I managed to get it right. Erikas had written to add extraAttackspeed when it actually was "uint32_t extraMagicDamage;" that should be there.The compiler is acting up on another part atm so gonan check if i can solve that 1 by myself..

Thanks anyways!
 
Last edited:
Yeah, but he had written that I should add "
uint32_t extraAttackSpeed;" And it's very confusing for me since I have never worked in source before... I don't even know c++ :p

I did however repost the guide with the small edits for anyone who would be as noob as me and don't wanna spend two days searching for the fault ! ^^
 
Back
Top