Horde3D
http://horde3d.org/forums/

[solved] Compiling problems with GCC 4.3.0
http://horde3d.org/forums/viewtopic.php?f=3&t=363
Page 1 of 1

Author:  Raedwulf [ 08.06.2008, 07:07 ]
Post subject:  [solved] Compiling problems with GCC 4.3.0

Essentially GCC 4.3.0 does not include c-headers when including C++ headers.
Hence, it breaks compatibility with Horde3d as it relies on this fact.

Here's some patches to fix it.

Code:
Index: trunk/Extensions/Terrain/Sample/main.cpp
===================================================================
--- trunk/Extensions/Terrain/Sample/main.cpp   (revision 28)
+++ trunk/Extensions/Terrain/Sample/main.cpp   (working copy)
@@ -14,6 +14,7 @@
 // *************************************************************************************************

 

 #include <iostream>

+#include <cstdlib>

 #include "glfw.h"

 #include "app.h"

 

Index: trunk/Horde3D/Source/ColladaConverter/utils.h
===================================================================
--- trunk/Horde3D/Source/ColladaConverter/utils.h   (revision 28)
+++ trunk/Horde3D/Source/ColladaConverter/utils.h   (working copy)
@@ -26,6 +26,8 @@
 #define _utils_H_

 

 #include "utMath.h"

+#include <cstring>

+#include <cstdlib>

 #include <string>

 using namespace std;

 

Index: trunk/Horde3D/Source/Horde3DUtils/main.cpp
===================================================================
--- trunk/Horde3D/Source/Horde3DUtils/main.cpp   (revision 28)
+++ trunk/Horde3D/Source/Horde3DUtils/main.cpp   (working copy)
@@ -31,6 +31,8 @@
 #   include <windows.h>

 #endif

 #include <GL/gl.h>

+#include <cstdlib>

+#include <cstring>

 #include <string>

 #include <vector>

 #include <map>

Index: trunk/Horde3D/Source/Horde3DEngine/utOpenGL.h
===================================================================
--- trunk/Horde3D/Source/Horde3DEngine/utOpenGL.h   (revision 28)
+++ trunk/Horde3D/Source/Horde3DEngine/utOpenGL.h   (working copy)
@@ -30,6 +30,8 @@
 #endif

 

 #include "utPlatform.h"

+#include <cstdlib>

+#include <cstring>

 

 #ifdef PLATFORM_WIN

 #   define WIN32_LEAN_AND_MEAN 1

Index: trunk/Horde3D/Source/Horde3DEngine/egPrerequisites.h
===================================================================
--- trunk/Horde3D/Source/Horde3DEngine/egPrerequisites.h   (revision 28)
+++ trunk/Horde3D/Source/Horde3DEngine/egPrerequisites.h   (working copy)
@@ -25,6 +25,9 @@
 #ifndef _egPrerequisites_H_

 #define _egPrerequisites_H_

 

+#include <cstdlib>

+#include <cstring>

+

 typedef unsigned int uint32;

 

 typedef int ResHandle;

Index: trunk/Horde3D/Source/Horde3DEngine/egRenderer.h
===================================================================
--- trunk/Horde3D/Source/Horde3DEngine/egRenderer.h   (revision 28)
+++ trunk/Horde3D/Source/Horde3DEngine/egRenderer.h   (working copy)
@@ -32,6 +32,7 @@
 #include "egCamera.h"

 #include "egModel.h"

 #include <vector>

+#include <algorithm>

 using namespace std;

 

 class MaterialResource;

Index: trunk/Horde3D/Samples/Knight/main.cpp
===================================================================
--- trunk/Horde3D/Samples/Knight/main.cpp   (revision 28)
+++ trunk/Horde3D/Samples/Knight/main.cpp   (working copy)
@@ -14,6 +14,7 @@
 // *************************************************************************************************

 

 #include <iostream>

+#include <cstdlib>

 #include "glfw.h"

 #include "app.h"

 

Index: trunk/Horde3D/Samples/Chicago/main.cpp
===================================================================
--- trunk/Horde3D/Samples/Chicago/main.cpp   (revision 28)
+++ trunk/Horde3D/Samples/Chicago/main.cpp   (working copy)
@@ -14,6 +14,7 @@
 // *************************************************************************************************

 

 #include <iostream>

+#include <cstdlib>

 #include "glfw.h"

 #include "app.h"

 

Author:  Volker [ 13.06.2008, 18:02 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

Thanks for this advice. As I don't have a GCC 4.3.0 configuration running, I can't test if it's really necessary to add cstdlib and cstring to egPrerequisities.h.

Can you try if the following patch is working, too?

Attachments:
File comment: GCC Patch created with Tortoise
gcc.zip [845 Bytes]
Downloaded 734 times

Author:  stalkerg [ 14.06.2008, 23:53 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

This problem not in gcc! This specific for new glibc(2.8).
On gcc 4.3.1 all ok.

Author:  gunnar [ 15.06.2008, 16:27 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

stalkerg wrote:
This problem not in gcc! This specific for new glibc(2.8).
On gcc 4.3.1 all ok.


Yes it is; I'm running gcc 4.3.1 + glibc 2.8, and the include problems are still there. I will apply the patch and see what happens.

Read the chapter "Header dependency cleanup" on this => http://gcc.gnu.org/gcc-4.3/porting_to.html page. Seems like they are implementing stuff that has been nailed down for C++0X.

Author:  Raedwulf [ 16.06.2008, 08:07 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

Yes Volker, your patch works too.
Maybe the topic should be renamed to "Compiling problems with glibc" ?

:P.

For my system:
Arch64

gcc 4.3.1 (updated today)
glibc 2.8

It is necessary to apply the patches.

Author:  Volker [ 16.06.2008, 08:20 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

Ok, I commited it to the SourceForge SVN

Author:  gunnar [ 16.06.2008, 10:22 ]
Post subject:  Re: Compiling problems with GCC 4.3.0

Volker wrote:
Ok, I commited it to the SourceForge SVN


Thank you :) I can confirm that the project now builds straight from svn on gcc 4.3.1 (all I need to add is the -msse2 flag).

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/