• 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!

Solved Error Syntax while compiling

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,480
Solutions
9
Reaction score
213
hello, I'm trying to implement a store system in my src, but I don't find a soluction when I try compile and get error, follow the error:
Code:
/home/adriano/otserver/src/game.cpp:5414:4: error: ‘g_store’ was not declared in this scope
    g_store->onTransactionCompleted(player->getAccount(), amount, "Purchased on Market");
    ^
/home/adriano/otserver/src/game.cpp:5449:5: error: ‘g_store’ was not declared in this scope
     g_store->onTransactionCompleted(sellerPlayer->getAccount(), -static_cast<int32_t>(amount), "Sold on Market");
     ^
/home/adriano/otserver/src/game.cpp:5458:6: error: ‘g_store’ was not declared in this scope
      g_store->onTransactionCompleted(sellerPlayer->getAccount(), -static_cast<int32_t>(amount), "Sold on Market");
      ^
cc1plus: all warnings being treated as errors
CMakeFiles/tfs.dir/build.make:623: recipe for target 'CMakeFiles/tfs.dir/src/game.cpp.o' failed
make[2]: *** [CMakeFiles/tfs.dir/src/game.cpp.o] Error 1
CMakeFiles/Makefile2:122: recipe for target 'CMakeFiles/tfs.dir/all' failed
make[1]: *** [CMakeFiles/tfs.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
here my game.cpp:
Code:
http://hastebin.com/evoqoforec.cpp
thanks in advice.
 
When you add a global into another file, you need to refer(declare without defining) to it.

add code like this into the file you are using "g_store" in.
Code:
#include "store.h"

extern Store* g_store;
 
Last edited:
When you add a global into another file, you need to refer to it.

add code like this into the file you are using "g_store" in.
Code:
#include "store.h"

extern Store* g_store;
lol, was my bad, forgot to include and refer :oops::oops::oops:
 
Last edited:
Back
Top