Build issues with MinGW/MSYS... or any compiler... [SOLVED]

m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Build issues with MinGW/MSYS... or any compiler... [SOLVED]

Post by m-ryan »

Having a spot of trouble building my game engine. This same error occurs with both the stable and SVN version on both Linux and Windows (XP & 7). I am building with MinGW on windows. (Shown here is MSYS output.)

Code: Select all

mike@mike-PC /c/mengin/lib/build/windows
$ make install
[  2%] Building CXX object CMakeFiles/SynCore.dir/c_/mengin/lib/src/physics/RigidBody.obj
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverConstraint.h:25:0,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h:21,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h:21,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/btBulletDynamicsCommon.h:28,
                 from c:/mengin/lib/src/physics/RigidBody.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h: In member function 'void btSolverBodyObsolete::getVelocityInLocalPointObsolete(const bt
Vector3&, btVector3&) const':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:123:29: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:123:90: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h: In member function 'void btSolverBodyObsolete::getAngularVelocity(btVector3&) const':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:131:27: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h: In member function 'void btSolverBodyObsolete::writebackVelocity()':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:160:18: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:160:52: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:161:18: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:161:53: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h: In member function 'void btSolverBodyObsolete::writebackVelocity(btScalar)':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:173:18: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:173:52: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:174:18: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:174:53: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:178:54: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btSolverBody.h:179:18: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h:21:0,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/btBulletDynamicsCommon.h:28,
                 from c:/mengin/lib/src/physics/RigidBody.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h: At global scope:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h:290:2: error: 'btRigidBodyData' does not name a type
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btTypedConstraint.h:291:2: error: 'btRigidBodyData' does not name a type
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/btBulletDynamicsCommon.h:29:0,
                 from c:/mengin/lib/src/physics/RigidBody.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h: In member function 'void btHingeConstraint::setAxis(btVector3&)':
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h:179:28: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/ConstraintSolver/btHingeConstraint.h:186:33: error: invalid use of incomplete type 'struct btRigidBody'
c:/mengin/lib/build/../src/physics/bullet/BulletCollision/BroadphaseCollision/btDispatcher.h:23:7: error: forward declaration of 'struct btRigidBody'
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/BulletDynamics/Vehicle/btRaycastVehicle.h:20:0,
                 from c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/bullet/btBulletDynamicsCommon.h:41,
                 from c:/mengin/lib/src/physics/RigidBody.cpp:10:
c:/mengin/lib/build/../src/physics/bullet/BulletDynamics/Dynamics/btActionInterface.h: In static member function 'static btRigidBody& btActionInterface::getFixedBody()':
c:/mengin/lib/build/../src/physics/bullet/BulletDynamics/Dynamics/btActionInterface.h:32:29: error: variable 'btRigidBody s_fixed' has initializer but incomplete type
make[2]: *** [CMakeFiles/SynCore.dir/c_/mengin/lib/src/physics/RigidBody.obj] Error 1
make[1]: *** [CMakeFiles/SynCore.dir/all] Error 2
make: *** [all] Error 2
If there's any other info you need, let me know. I am using CMake to build my project. I am configuring bullet in CMake with -DBUILD_EXTRAS=off and -DBUILD_DEMOS=off.
Last edited by m-ryan on Fri Apr 01, 2011 12:51 pm, edited 2 times in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build issues with WinGW/MSYS

Post by Erwin Coumans »

I cannot reproduce this, Bullet builds just fine under all platforms, including Linux (32bit/64bit) and the latest MinGW
(using cmake .. -G "MinGW Makefiles")

Code: Select all

C:\MinGW\msys\1.0\home\Administrator\bullet\mingw>cmake .
OPENCL NOT FOUND
OPENGL FOUND
glu32opengl32
-- WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instea
d
GLUT NOT FOUND not found, trying to use MINGW glut32
GLUT NOT FOUND
-- Configuring done
-- Generating done
-- Build files have been written to: C:/MinGW/msys/1.0/home/Administrator/bullet
/mingw

C:\MinGW\msys\1.0\home\Administrator\bullet\mingw>mingw32-make
[  3%] Built target MiniCL
[ 16%] Built target BulletMultiThreaded
[ 21%] Built target BulletSoftBody
[ 83%] Built target BulletCollision
[ 96%] Built target BulletDynamics
[ 99%] Built target LinearMath
[100%] Built target BulletSoftBodySolvers_CPU

C:\MinGW\msys\1.0\home\Administrator\bullet\mingw>
C:\MinGW\msys\1.0\home\Administrator\bullet\mingw>g++ --version
g++ (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Did you make any modifications to Bullet?
Thanks,
Erwin
m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Re: Build issues with WinGW/MSYS

Post by m-ryan »

I didn't make any modifications, and I am still having the same problems. I have the library built just fine from the svn, that is the weird part. It is just trying to include what is needed that is giving me problems. Did something get broken? Do I need to -D something in my build script?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build issues with WinGW/MSYS

Post by Erwin Coumans »

I didn't make any modifications, and I am still having the same problem. I have the library built just fine from the svn, that is the weird part.
This is confusing. In the first sentence you state you have build problems, but in the second sentence you state that SVN version build just fine.

So the Bullet SDK builds fine, but your own application fails to build?
Thanks,
Erwin
m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Re: Build issues with WinGW/MSYS

Post by m-ryan »

Yes, it fails with the same error that I posted in the opening post.

Sorry about that, I'm not that good at wording questions when I am completely confused.

I looked into it and I see absolutely no reason why it can't see btRigidBody. It not only forward-declares btRigidBody in btSolverBody.h, but also includes the header... I just... what is this, I don't even... to top it off, I can't see any preprocessing in btRigidBody.h that would exclude the class from being compiled.

By the way, this also occurs on Linux (just tried it today).
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build issues with WinGW/MSYS

Post by Erwin Coumans »

It is still not clear. Can you answer each question separately?

1) Does the Bullet SDK and its demos from the latest SVN build fine using MinGW/MSYS?

2) Is it your own application that fails to build?

Thanks,
Erwin
m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Re: Build issues with WinGW/MSYS

Post by m-ryan »

Yes on both.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Build issues with WinGW/MSYS

Post by Erwin Coumans »

Can you attach the file c:/mengin/lib/src/physics/RigidBody.cpp to this forum topic (zipped), perhaps someone catches the issue.

Thanks,
Erwin
m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Re: Build issues with WinGW/MSYS

Post by m-ryan »

It's small enough to where I can post it right here.

Code: Select all

#include "RigidBody.h"
#include "ShapeManager.h"
#include "World.h"

#include "../core/Engine.h"
#include "../core/Stage.h"
#include "../rendering/Node.h"

#include "../shared/Math.h"

#include "btBulletCollisionCommon.h"
#include "btBulletDynamicsCommon.h"

namespace Syn {

// Static... yeah, yeah, I know. But it's better than singleton.
ShapeManager* RigidBody::SHAPE_MANAGER=new ShapeManager();

struct RigidBody::Cheshire
{

	float x,y,z;
	float rx, ry, rz;
};

// Inherits a subclass called Object, defines void Update(float) as pure virtual.
RigidBody::RigidBody(Engine* e,ID shape)
    : m_smile(new Cheshire),
       m_engine(e)
{
	m_type = Object::RIGID_BODY;
	m_world = Stage::GetCurrentStage()->GetWorld();
}

RigidBody::~RigidBody()
{
    delete m_smile;
}

/*void RigidBody::EnableCollisionDetection(){}
void RigidBody::DisableCollisionDetection(){}*/
void RigidBody::SetMass(float mass){}
void RigidBody::SetAutoDisable(bool val){}
void RigidBody::SetAutoDisableThreshold(float t){}

void RigidBody::GetPos(float* x,float* y,float* z)
{
	*x = m_smile->x;
	*y = m_smile->y;
	*z = m_smile->z;
}

void RigidBody::SetPos(float x,float y,float z)
{
}

void RigidBody::GetRot(float* x,float* y,float* z)
{
	*x = m_smile->rx;
	*y = m_smile->ry;
	*z = m_smile->rz;
}

void RigidBody::SetDynamic(){}
void RigidBody::SetStatic(){}
void RigidBody::SetKinematic(){}
void RigidBody::ApplyLinearImpulse(float x,float y,float z){}
void RigidBody::ApplyTorqueImpulse(float x,float y,float z){}
bool RigidBody::IsColliding(RigidBody* other){return false;}
void RigidBody::OnBeginCollide(RigidBody* other){}
void RigidBody::OnEndCollide(RigidBody* other){}
float RigidBody::GetRestitution(){return 0.0f;}
void RigidBody::SetRestitution(float val){}
void RigidBody::Update(float delta){}
int* RigidBody::Get()
{
        // returns int* as a placeholder for now. "Get" just returns the native rigid body type for whatever API i decide to use. [gone through ODE, Newton, and now Bullet]
        // I may just make RigidBody a template type. I dunno...
        return new int(9001);
}

}
m-ryan
Posts: 11
Joined: Sat Mar 19, 2011 11:47 pm

Re: Build issues with WinGW/MSYS

Post by m-ryan »

I have now tried using my distro's package manager to install bullet (Arch Linux), and even including everything absolute (#include "/usr/include/bullet/<stuff>.h") doesn't work. It keeps giving me the same error!

Tell me that I am not the only one that is having this problem.

EDIT: SOLVED IT!!!

The header guard in RigidBody.h conflicted with your header guards Erwin.

Code: Select all

#ifndef RIGIDBODY_H
#define RIGIDBODY_H

class RigidBody{};

#endif
That conflicts with the header guard in btRigidBody.h