As a newbie at Bullet, I 'm afraid I still need your help for my problem.
With VC++ I created a dialog based program (with MFC) and tried to integrate Bullet on it.
I included src directory in my project settings and added the following lines :
// Adding Bullet specific libraries
#pragma comment (lib, "C:\\BULLET\\bullet-2.75\\lib\\libbulletmath.lib")
#pragma comment (lib, "C:\\BULLET\\bullet-2.75\\lib\\libbulletdynamics.lib")
#pragma comment (lib, "C:\\BULLET\\bullet-2.75\\lib\\libbulletcollision.lib")
on my project.
At this point, compilation was working perfectly.
Then I used the code I found on this page : http://bulletphysics.org/mediawiki-1.5. ... ello_World
Now I get 3 errors when compiling, telling that "no overloaded function needs 3 parameters" at the following lines :
btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);
btCollisionShape* fallShape = new btSphereShape(1);
btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
I am quite sure the code is correct as I cut & paste it from the wiki. So I think I am missing something at project settings ... What can I do to make this demo work for me ? Is there something wrong with using the MFC and Bullet together ?
Thank you for your help.
Can not build demo
-
ByB
- Posts: 11
- Joined: Mon Jan 11, 2010 4:23 pm
Re: Can not build demo
FYI, the error code from VC++ compiler is always the same : "error C2661 : 'function' : no overloaded function takes number parameters"
-
ByB
- Posts: 11
- Joined: Mon Jan 11, 2010 4:23 pm
Re: Can not build demo
FYI, I just noticed that only the Debug version of my program shows the problems I indicated before. The release version seems to compile with no problems.
-
gustav
- Posts: 12
- Joined: Mon Jan 11, 2010 9:40 am
Re: Can not build demo
May be that code (from wiki) you use was written for a diffrent version of Bullet than the one you have ... So realization of some methods may not coincide ...
-
Martin Kraus
- Posts: 1
- Joined: Fri Jan 15, 2010 10:03 am
Re: Can not build demo
I added step-by-step instructions for building the Hello World example with Visual Studio 2008 in the Bullet Wiki: http://bulletphysics.org/mediawiki-1.5. ... om_scratch
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Can not build demo
It is likely some global new/delete operator in the MFC or Windows headers that conflict with the new/delete operator in Bullet, see Bullet/src/LinearMath/btScalar.h
Can you try to include the Bullet include files before any MFC/Windows includes (or first in the stdafx.h / precompiled header file if you use those)?
Otherwise, we need more information about the errors. If above doesn't help, can you copy and past a few more lines of the actual error message (around 10 lines should do)?
Thanks,
Erwin
Code: Select all
#define BT_DECLARE_ALIGNED_ALLOCATOR() \
SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \
SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \
SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \
SIMD_FORCE_INLINE void operator delete(void*, void*) { } \
SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \
SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \
SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \
SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \
Otherwise, we need more information about the errors. If above doesn't help, can you copy and past a few more lines of the actual error message (around 10 lines should do)?
Thanks,
Erwin
-
satitpor
- Posts: 2
- Joined: Thu Jan 28, 2010 1:20 pm
Re: Can not build demo
I have the same problem as ByB.
Here my entire error list:
Error 1 error C2661: 'btAxisSweep3Internal<BP_FP_INT_TYPE>::operator new' : no overloaded function takes 3 arguments
Error 2 error C2661: 'btSphereShape::operator new' : no overloaded function takes 3 arguments
Error 3 error C2661: 'btCollisionObject::operator new' : no overloaded function takes 3 arguments
Error 4 error C2661: 'btCollisionObject::operator new' : no overloaded function takes 3 arguments
When I try
Error 1 fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxv_w32.h
Here my entire error list:
Error 1 error C2661: 'btAxisSweep3Internal<BP_FP_INT_TYPE>::operator new' : no overloaded function takes 3 arguments
Error 2 error C2661: 'btSphereShape::operator new' : no overloaded function takes 3 arguments
Error 3 error C2661: 'btCollisionObject::operator new' : no overloaded function takes 3 arguments
Error 4 error C2661: 'btCollisionObject::operator new' : no overloaded function takes 3 arguments
When I try
It say:Erwin Coumans wrote:Can you try to include the Bullet include files before any MFC/Windows includes (or first in the stdafx.h / precompiled header file if you use those)?
Error 1 fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxv_w32.h
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Can not build demo
There are a few possible solutions.
One is to undefine the global new and delete definitions, by adding those lines just before adding the Bullet headers:
A better solution is saving the new/delete macros, then undefining them, and later restoring them. This is described here:
http://stackoverflow.com/questions/1128 ... riding-new
So before including the Bullet header(s), add:
And afterwards add:
And the same for delete.
The last solution is to get rid of windows.h from the Bullet headers, there is only headerfile that needs a fix, which is Bullet\src\LinearMath\btQuickprof.h
Make sure to define
Hope this helps,
Erwin
One is to undefine the global new and delete definitions, by adding those lines just before adding the Bullet headers:
Code: Select all
#undef new
#undef delete
#include "btBulletDynamicsCommon.h"
http://stackoverflow.com/questions/1128 ... riding-new
So before including the Bullet header(s), add:
Code: Select all
#ifdef new
#define NEW_WAS_DEFINED
#pragma push_macro("new")
#undef new
#endif
Code: Select all
#ifdef NEW_WAS_DEFINED
#undef NEW_WAS_DEFINED
#pragma pop_macro("new")
#endif
The last solution is to get rid of windows.h from the Bullet headers, there is only headerfile that needs a fix, which is Bullet\src\LinearMath\btQuickprof.h
Make sure to define
Code: Select all
#define BT_NO_PROFILE 1
Erwin
-
satitpor
- Posts: 2
- Joined: Thu Jan 28, 2010 1:20 pm
Re: Can not build demo
Thank you very much Erwin Coumans.