Compile Error - Ubuntu LTS 14.04

Post Reply
Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Compile Error - Ubuntu LTS 14.04

Post by Korietsu » Thu Nov 06, 2014 8:59 pm

Hi Guys,

I'm running into an issue compiling from a pull from the git today.

I'e run into this issue during the make process:

ffxi@ffxidsp:~/darkstar$ make
g++ -std=gnu++0x -DHAVE_CONFIG_H -I. -I./src/common -DdsUDPSERV -I/usr//include/luajit-2.0 -I/usr/include/mysql -DBIG_JOINS=1 -fno-strict-aliasing -DTAOCRYPT_DISABLE_X86ASM -g -DNDEBUG -g -O2 -MT dsgame-luautils.o -MD -MP -MF .deps/dsgame-luautils.Tpo -c -o dsgame-luautils.o `test -f 'src/map/lua/luautils.cpp' || echo './'`src/map/lua/luautils.cpp
src/map/lua/luautils.cpp: In function ‘bool luautils::IsExpansionEnabled(const char*)’:
src/map/lua/luautils.cpp:993:11: error: ‘TRUE’ was not declared in this scope
return TRUE;
^
src/map/lua/luautils.cpp:997:9: error: ‘FALSE’ was not declared in this scope
return FALSE;
^
make: *** [dsgame-luautils.o] Error 1
ffxi@ffxidsp:~/darkstar$

Here's the related structure in the .cpp

bool IsExpansionEnabled(const char* expansionCode)
{
if (expansionCode != NULL){
char* expansionVariable = new char[14];
sprintf(expansionVariable, "ENABLE_%s", expansionCode);
uint8 expansionEnabled = GetSettingsVariable(expansionVariable);
if (expansionEnabled == 0){
return TRUE;
}
}
return FALSE;
}

Any ideas for a quick fix? I need to test some issues with sagheera and I haven't made my test server compliant with my game client in a while.

Thanks!

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Compile Error - Ubuntu LTS 14.04

Post by kjLotus » Fri Nov 07, 2014 2:23 am

quick fix: replace TRUE/FALSE with true/false

i'll fix it in the trunk right now if you just pull though

Korietsu
Posts: 12
Joined: Tue Apr 29, 2014 1:12 pm

Re: Compile Error - Ubuntu LTS 14.04

Post by Korietsu » Fri Nov 07, 2014 11:18 am

Ah, you can't use a full caps to parse to boolean like say java or lua?

That's absolutely hilarious. Another reason why I hate C++.

Thanks kJ

User avatar
atom0s
Developer
Posts: 537
Joined: Thu Oct 25, 2012 9:52 am

Re: Compile Error - Ubuntu LTS 14.04

Post by atom0s » Fri Nov 07, 2014 3:10 pm

Korietsu wrote:Ah, you can't use a full caps to parse to boolean like say java or lua?

That's absolutely hilarious. Another reason why I hate C++.

Thanks kJ
bool is a datatype that is actually defined be the C99 standard. This is an actual datatype to the language that holds a specific true/false value. It cannot hold any other value outside of true/false. The only manner in which it can be set to hold a different value aside from the true/false keywords is casting it from a 0/1 value which holds the same value.

BOOL is not a datatype specific to the language. It is actually just a typedef (signed char). This means that FALSE being 0 is fine, however TRUE can be any number 1 or above. This does not follow the standard or guideline to how the datatype 'bool' works. Thus you will get compiler warnings trying to use one or the other with the opposites values.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Compile Error - Ubuntu LTS 14.04

Post by kjLotus » Fri Nov 07, 2014 3:25 pm

Korietsu wrote:Ah, you can't use a full caps to parse to boolean like say java or lua?

That's absolutely hilarious. Another reason why I hate C++.

Thanks kJ
it's really not any different than trying to use any keyword in any other language (like java or lua)

Post Reply