Author Topic: compile errors on linux  (Read 2217 times)

bork

  • Guest
compile errors on linux
« on: 2 April 2009, 19:18:29 »
Not sure if it should be here or in GAE forum, but I've got strange compile errors for GAE trunk on linux. It looks like some headers are missing in shared_lib sources. I've used this gcc/OS combination for building:

gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11)
Linux 2.6.24-23-generic #1 SMP Mon Jan 26 00:13:11 UTC 2009 i686 GNU/Linux

Here is a patch fixing compilation errors.

Code: [Select]
diff -r 5270971cbbdf glest_game/game/game_camera.cpp
--- a/glest_game/game/game_camera.cpp   Thu Apr 02 09:41:27 2009 +0400
+++ b/glest_game/game/game_camera.cpp   Thu Apr 02 09:47:36 2009 +0400
@@ -11,10 +11,13 @@
 
 #include "game_camera.h"
 
+#include <cmath>
+
 #include "config.h"
 #include "game_constants.h"
 #include "leak_dumper.h"
 
+using namespace std;
 using namespace Shared::Graphics;
 
 namespace Glest{ namespace Game{
diff -r 5270971cbbdf glest_game/game/game_settings.cpp
--- a/glest_game/game/game_settings.cpp Thu Apr 02 09:41:27 2009 +0400
+++ b/glest_game/game/game_settings.cpp Thu Apr 02 09:47:36 2009 +0400
@@ -10,8 +10,12 @@
 // ==============================================================
 
 #include "game_settings.h"
+
+#include <cstring>
+
 #include "random.h"
 
+using namespace std;
 using Shared::Util::Random;
 
 namespace Glest { namespace Game {
diff -r 5270971cbbdf shared_lib/sources/platform/posix/socket.cpp
--- a/shared_lib/sources/platform/posix/socket.cpp      Thu Apr 02 09:41:27 2009 +0400
+++ b/shared_lib/sources/platform/posix/socket.cpp      Thu Apr 02 09:47:36 2009 +0400
@@ -8,6 +8,8 @@
 
 #include "socket.h"
 
+#include <cstdlib>
+#include <cstring>
 #include <stdexcept>
 #include <sstream>
 #if defined(HAVE_SYS_IOCTL_H)
diff -r 5270971cbbdf shared_lib/sources/util/conversion.cpp
--- a/shared_lib/sources/util/conversion.cpp    Thu Apr 02 09:41:27 2009 +0400
+++ b/shared_lib/sources/util/conversion.cpp    Thu Apr 02 09:47:36 2009 +0400
@@ -11,6 +11,7 @@
 
 #include "conversion.h"
 
+#include <cstdlib>
 #include <stdexcept>
 #include <cstdio>
 
diff -r 5270971cbbdf shared_lib/sources/util/properties.cpp
--- a/shared_lib/sources/util/properties.cpp    Thu Apr 02 09:41:27 2009 +0400
+++ b/shared_lib/sources/util/properties.cpp    Thu Apr 02 09:47:36 2009 +0400
@@ -11,6 +11,7 @@
 
 #include "properties.h"
 
+#include <cstring>
 #include <fstream>
 #include <stdexcept>
 
diff -r 5270971cbbdf shared_lib/sources/util/util.cpp
--- a/shared_lib/sources/util/util.cpp  Thu Apr 02 09:41:27 2009 +0400
+++ b/shared_lib/sources/util/util.cpp  Thu Apr 02 09:47:36 2009 +0400
@@ -11,6 +11,7 @@
 
 #include "util.h"
 
+#include <cstring>
 #include <ctime>
 #include <cassert>
 #include <stdexcept>

Below are error messages I've got.

shared_lib/sources/platform/posix/socket.cpp: In constructor ‘Shared::Platform::Ip::Ip(const std::string&)’:
shared_lib/sources/platform/posix/socket.cpp:54: error: ‘atoi’ was not declared in this scope
shared_lib/sources/platform/posix/socket.cpp: In static member function ‘static void Shared::Platform::Socket::throwException(const std::string&)’:
shared_lib/sources/platform/posix/socket.cpp:207: error: ‘strerror’ was not declared in this scope
shared_lib/sources/platform/posix/socket.cpp: In member function ‘void Shared::Platform::ClientSocket::connect(const Shared::Platform::Ip&, int)’:
shared_lib/sources/platform/posix/socket.cpp:217: error: ‘memset’ was not declared in this scope

g++ -c -o ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/platform/posix/socket.o  -I/usr/include -DPACKAGE_NAME="gae" -DPACKAGE_TARNAME="gae" -DPACKAGE_VERSION="0.2.0-wip" -DPACKAGE_STRING="gae 0.2.0-wip" -DPACKAGE_BUGREPORT="daniel.santos@pobox.com" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS= -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL= -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -Ishared_lib/sources/../include/platform/sdl -Ishared_lib/sources/../include/platform/posix -Ishared_lib/sources/../include/util -Ishared_lib/sources/../include/graphics -Ishared_lib/sources/../include/graphics/gl -Ishared_lib/sources/../include/sound -Ishared_lib/sources/../include/sound/openal -Ishared_lib/sources/../include/xml -Ishared_lib/sources/../include/glew   -O3 -DNDEBUG shared_lib/sources/platform/posix/socket.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/platform/posix/socket.o ...
C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/properties.o
shared_lib/sources/util/properties.cpp: In member function ‘void Shared::Util::Properties::load(const std::string&)’:
shared_lib/sources/util/properties.cpp:50: error: ‘strlen’ was not declared in this scope

g++ -c -o ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/properties.o  -I/usr/include -DPACKAGE_NAME="gae" -DPACKAGE_TARNAME="gae" -DPACKAGE_VERSION="0.2.0-wip" -DPACKAGE_STRING="gae 0.2.0-wip" -DPACKAGE_BUGREPORT="daniel.santos@pobox.com" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS= -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL= -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -Ishared_lib/sources/../include/platform/sdl -Ishared_lib/sources/../include/platform/posix -Ishared_lib/sources/../include/util -Ishared_lib/sources/../include/graphics -Ishared_lib/sources/../include/graphics/gl -Ishared_lib/sources/../include/sound -Ishared_lib/sources/../include/sound/openal -Ishared_lib/sources/../include/xml -Ishared_lib/sources/../include/glew   -O3 -DNDEBUG shared_lib/sources/util/properties.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/properties.o ...
C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/conversion.o
shared_lib/sources/util/conversion.cpp: In function ‘int Shared::Util::strToInt(const std::string&)’:
shared_lib/sources/util/conversion.cpp:37: error: ‘strtol’ was not declared in this scope
shared_lib/sources/util/conversion.cpp: In function ‘float Shared::Util::strToFloat(const std::string&)’:
shared_lib/sources/util/conversion.cpp:49: error: ‘strtod’ was not declared in this scope
shared_lib/sources/util/conversion.cpp: In function ‘bool Shared::Util::strToInt(const std::string&, int*)’:
shared_lib/sources/util/conversion.cpp:73: error: ‘strtol’ was not declared in this scope
shared_lib/sources/util/conversion.cpp: In function ‘bool Shared::Util::strToFloat(const std::string&, float*)’:
shared_lib/sources/util/conversion.cpp:83: error: ‘strtod’ was not declared in this scope

g++ -c -o ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/conversion.o  -I/usr/include -DPACKAGE_NAME="gae" -DPACKAGE_TARNAME="gae" -DPACKAGE_VERSION="0.2.0-wip" -DPACKAGE_STRING="gae 0.2.0-wip" -DPACKAGE_BUGREPORT="daniel.santos@pobox.com" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS= -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL= -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -Ishared_lib/sources/../include/platform/sdl -Ishared_lib/sources/../include/platform/posix -Ishared_lib/sources/../include/util -Ishared_lib/sources/../include/graphics -Ishared_lib/sources/../include/graphics/gl -Ishared_lib/sources/../include/sound -Ishared_lib/sources/../include/sound/openal -Ishared_lib/sources/../include/xml -Ishared_lib/sources/../include/glew   -O3 -DNDEBUG shared_lib/sources/util/conversion.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/conversion.o ...
C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/util.o
shared_lib/sources/util/util.cpp: In function ‘void Shared::Util::copyStringToBuffer(char*, int, const std::string&)’:
shared_lib/sources/util/util.cpp:117: error: ‘strncpy’ was not declared in this scope

g++ -c -o ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/util.o  -I/usr/include -DPACKAGE_NAME="gae" -DPACKAGE_TARNAME="gae" -DPACKAGE_VERSION="0.2.0-wip" -DPACKAGE_STRING="gae 0.2.0-wip" -DPACKAGE_BUGREPORT="daniel.santos@pobox.com" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS= -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL= -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -Ishared_lib/sources/../include/platform/sdl -Ishared_lib/sources/../include/platform/posix -Ishared_lib/sources/../include/util -Ishared_lib/sources/../include/graphics -Ishared_lib/sources/../include/graphics/gl -Ishared_lib/sources/../include/sound -Ishared_lib/sources/../include/sound/openal -Ishared_lib/sources/../include/xml -Ishared_lib/sources/../include/glew   -O3 -DNDEBUG shared_lib/sources/util/util.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/util/util.o ...
...skipped libglestlib.a for lack of libglestlib.a(socket.o)...
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/game/game_camera.o
glest_game/game/game_camera.cpp: In member function ‘void Glest::Game::GameCamera::update()’:
glest_game/game/game_camera.cpp:103: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp:106: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp:117: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp:120: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp:123: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp: In member function ‘void Glest::Game::GameCamera::zoom(float)’:
glest_game/game/game_camera.cpp:236: error: ‘abs’ was not declared in this scope
glest_game/game/game_camera.cpp:238: error: ‘abs’ was not declared in this scope

g++ -c -o ./build/i686-pc-linux-gnu/optimize/glest_game/game/game_camera.o  -I/usr/include -DPACKAGE_NAME="gae" -DPACKAGE_TARNAME="gae" -DPACKAGE_VERSION="0.2.0-wip" -DPACKAGE_STRING="gae 0.2.0-wip" -DPACKAGE_BUGREPORT="daniel.santos@pobox.com" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS= -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL= -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -Iglest_game/../shared_lib/include/../include/platform/sdl -Iglest_game/../shared_lib/include/../include/platform/posix -Iglest_game/../shared_lib/include/../include/util -Iglest_game/../shared_lib/include/../include/graphics -Iglest_game/../shared_lib/include/../include/graphics/gl -Iglest_game/../shared_lib/include/../include/sound -Iglest_game/../shared_lib/include/../include/sound/openal -Iglest_game/../shared_lib/include/../include/xml -Iglest_game/../shared_lib/include/../include/glew -Iglest_game/. -Iglest_game/ai -Iglest_game/facilities -Iglest_game/game -Iglest_game/global -Iglest_game/graphics -Iglest_game/gui -Iglest_game/main -Iglest_game/menu -Iglest_game/network -Iglest_game/sound -Iglest_game/type_instances -Iglest_game/types -Iglest_game/world   -O3 -DNDEBUG glest_game/game/game_camera.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/glest_game/game/game_camera.o ...
...removing ./build/i686-pc-linux-gnu/optimize/glest_game/game/game_camera.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/game/game_settings.o
glest_game/game/game_settings.cpp: In member function ‘void Glest::Game::GameSettings::randomizeLocs()’:
glest_game/game/game_settings.cpp:61: error: ‘memset’ was not declared in this scope

 

anything