FreeCNC doensn't compile on Mandriva 2010.2

2011-04-13
2013-04-25
  • Maik Wagner
    Maik Wagner
    2011-04-13

    Hello,

    I am trying to compile "freecnc" on my Mandriva 2010.2 box and when I am running "make" I get the following output.

    [mwagner@localhost freecnc++]$ make
    Going to use Linux specific settings
    make -C src
    make[1]: Entering directory `/home/mwagner/Downloads/freecnc/freecnc++/src'
    g++ -Wall -Werror -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -std=c++98 -Wconversion -W -Wno-unused -c freecnc.cpp -o freecnc.o -I./include  -I./include/lua
    g++ -Wall -Werror -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -std=c++98 -Wconversion -W -Wno-unused -c audio/soundengine.cpp -o audio/soundengine.o -I./include  -I./include/lua
    g++ -Wall -Werror -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -std=c++98 -Wconversion -W -Wno-unused -c game/actioneventqueue.cpp -o game/actioneventqueue.o -I./include  -I./include/lua
    g++ -Wall -Werror -g  -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -std=c++98 -Wconversion -W -Wno-unused -c game/aiplugman.cpp -o game/aiplugman.o -I./include  -I./include/lua
    cc1plus: warnings being treated as errors
    In file included from game/aiplugman.cpp:5:
    ./include/ccmap.h: In member function »bool CnCMap::getResource(Uint32, Uint8*, Uint8*) const«:
    ./include/ccmap.h:140: Fehler: Umwandlung in »unsigned char« von »short unsigned int« könnte den Wert ändern
    ./include/ccmap.h:141: Fehler: Umwandlung in »unsigned char« von »int« könnte den Wert ändern
    ./include/ccmap.h: In member function »void CnCMap::translateCoord(Uint32, Uint16*, Uint16*) const«:
    ./include/ccmap.h:248: Fehler: Umwandlung in »short unsigned int« von »Uint32« könnte den Wert ändern
    ./include/ccmap.h:251: Fehler: Umwandlung in »short unsigned int« von »Uint32« könnte den Wert ändern
    In file included from ./include/playerpool.h:9,
                     from game/aiplugman.cpp:9:
    ./include/player.h: In member function »Uint16 Player::getStructureLosses() const«:
    ./include/player.h:83: Fehler: Umwandlung in »Uint16« von »unsigned int« könnte den Wert ändern
    In file included from game/aiplugman.cpp:9:
    ./include/playerpool.h: In member function »Uint8 PlayerPool::getNumPlayers() const«:
    ./include/playerpool.h:38: Fehler: Umwandlung in »Uint8« von »size_t« könnte den Wert ändern
    make[1]: *** [game/aiplugman.o] Fehler 1
    make[1]: Leaving directory `/home/mwagner/Downloads/freecnc/freecnc++/src'
    make: *** [default] Fehler 2
    

    Please advise.

     
  • khaan_
    khaan_
    2011-04-26

    Hi,

    Try editing the file called config that was created at the root of the freecnc++ folder when you first run make. Search inside for " -Werror" and just delete that. This will tell the compiler to keep compiling when it encounters warnings instead of transforming them to errors, thus aborting compilation.

    Doing that did not solve every problem for me. I also had to add 1 line to the code, as shown in this diff output:

    --- freecnc++/src/include//structure.h  2004-12-19 01:54:12.000000000 +0000
    +++ freecnc++2/src/include//structure.h 2011-04-26 15:57:19.875919947 +0100
    @@ -156,10 +156,11 @@
         std::vector<Uint8> passengerAllow;
         // matches the unit's type name.
         std::vector<UnitType*> specificTypeAllow;
     };
    
    +class BuildingAnimEvent;
     class BAttackAnimEvent;
    
     class Structure : public UnitOrStructure
     {
     public:
    

    Hope it helps