simtr / PowderToypp

This repository has been moved to https://github.com/FacialTurd/The-Powder-Toy
https://github.com/FacialTurd/The-Powder-Toy
GNU General Public License v3.0
20 stars 12 forks source link

Does not build with GCC 4.7 #194

Closed Huulivoide closed 12 years ago

Huulivoide commented 12 years ago

g++ -o build/src/cat/CommandInterface.o -c -w -std=c99 -fkeep-inline-functions -m64 -msse3 -O3 -ftree-vectorize -funsafe-math-optimizations -ffast-math -fomit-frame-pointer -funsafe-loop-optimizations -Wunsafe-loop-optimizations -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_SDL -DLUACONSOLE -DGRAVFFT -D_GNU_SOURCE DUSE_STDINT -D_POSIX_C_SOURCE=200112L -DLIN -D_64BIT -DSAVE_VERSION=83 -DMINOR_VERSION=9 -DBUILD_NUM=232 -DX86 -DX86_SSE3 -I/usr/include/SDL -Ibuild/src -Ibuild/data -Ibuild/generated build/src/cat/CommandInterface.cpp

I think this warning should be fixed too. Do earlier versions (4.6/4.5) of GCC give this message?

cc1plus: warning: command line option '-std=c99' is valid for C/ObjC but not for C++ [enabled by default]

In file included from build/src/simulation/elements/Element.h:7:0, from build/generated/ElementClasses.h:7, from build/src/simulation/Elements.h:97, from build/src/simulation/Simulation.h:15, from build/src/game/GameModel.h:7, from build/src/cat/CommandInterface.cpp:15:

build/src/simulation/StructProperty.h:19:2: error: 'intptr_t' does not name a type build/src/simulation/StructProperty.h:21:54: error: 'intptr_t' has not been declared build/src/simulation/StructProperty.h: In constructor 'StructProperty::StructProperty(std::string, StructProperty::PropertyType, int)': build/src/simulation/StructProperty.h:24:2: error: class 'StructProperty' does not have any field named 'Offset' build/src/simulation/StructProperty.h: In constructor 'StructProperty::StructProperty()': build/src/simulation/StructProperty.h:32:2: error: class 'StructProperty' does not have any field named 'Offset'

Huulivoide commented 12 years ago

Ok this can be fixed by adding

include

into build/src/simulation/StructProperty.h

Also file src/cat/LuaScriptInterface.cpp needs

include

Huulivoide commented 12 years ago

Also I think this is not exactly a GCC 4.7 problem, but a 64bit one, altought it might be that versions of GCC before 4.7 do not complain about this.

build/src/pim/Machine.cpp: In member function 'void pim::VirtualMachine::Compile()': build/src/pim/Machine.cpp:427:39: error: cast from 'unsigned char' to 'int' loses precision [-fpermissive] build/src/pim/Machine.cpp:431:20: error: cast from 'unsigned char' to 'int' loses precision [-fpermissive] build/src/pim/Machine.cpp:436:20: error: cast from 'unsigned char' to 'int' loses precision [-fpermissive] build/src/pim/Machine.cpp:440:39: error: cast from 'unsigned char' to 'int' loses precision [-fpermissive]

Adding -fpermissive flag is a aption of course, but ofcourse fixing the actual problem would be better. Quick Googling suggests replacing int with 'intptr_t' but I don't really know C++ nor the code base to tell weather this is the right thing to do, it did fix the error and quick test didin't results in any abnormalities. Altought I do not know if I tested functionality using those codepaths

kroq-gar78 commented 12 years ago

Hello, I can confirm the casting from 'unsigned char' issue on my 64-bit Ubuntu 12.04 machine. If I can fix this, I can update my Debian package and resubmit it to Debian.

kroq-gar78 commented 12 years ago

Was this fixed in the latest commit (commit 249e3dcad3aa62ba09e0b712ff508d94f255a947)?

jacob1 commented 12 years ago

Yes, ec413dd05 (and that one too)