Errors with Visual Studio compilation

Post Reply
Shtille
Posts: 8
Joined: Sat Jan 21, 2017 5:08 pm

Errors with Visual Studio compilation

Post by Shtille »

Hi there.
I'm trying to port my application to Windows and got issues with Bullet (2.85.1) compilation:

Code: Select all

linearmath\btvector3.h(87): error C2059: syntax error: 'constant'
linearmath\btvector3.h(87): error C2091: function returns function
linearmath\btvector3.h(87): error C2802: static member 'operator new' has no formal parameters
linearmath\btvector3.h(87): error C2333: 'btVector3::operator new': error in function declaration; skipping function body
linearmath\btvector3.h(87): error C2556: 'void *(__cdecl *btVector3::operator new(void))(std::size_t,void *)': overloaded function differs only by return type from 'void *(__cdecl *btVector3::operator new(void))(std::size_t)'
linearmath\btvector3.h(87): note: see declaration of 'btVector3::operator new'
linearmath\btvector3.h(87): error C2059: syntax error: 'return'
linearmath\btvector3.h(87): error C2238: unexpected token(s) preceding ';'
linearmath\btvector3.h(87): error C2628: 'btVector3' followed by 'void' is illegal (did you forget a ';'?)
linearmath\btvector3.h(87): error C2556: 'btVector3 operator delete(void *,void *)': overloaded function differs only by return type from 'void operator delete(void *,void *) throw()'
7>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vcruntime_new.h(92): note: see declaration of 'operator delete'
linearmath\btvector3.h(87): error C2371: 'operator delete': redefinition; different basic types
7>  c:\program files (x86)\microsoft visual studio 14.0\vc\include\vcruntime_new.h(92): note: see declaration of 'operator delete'
linearmath\btvector3.h(87): error C2433: 'new': '__forceinline' not permitted on data declarations
linearmath\btvector3.h(87): error C2473: 'operator new': looks like a function definition, but there is no parameter list.
linearmath\btvector3.h(87): error C2365: 'operator new': redefinition; previous definition was 'function'
linearmath\btvector3.h(87): error C2143: syntax error: missing ';' before '['
linearmath\btvector3.h(87): error C3409: empty attribute block is not allowed
linearmath\btvector3.h(87): error C2146: syntax error: missing ')' before identifier 'sizeInBytes'
linearmath\btvector3.h(87): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
linearmath\btvector3.h(87): error C2377: 'size_t': redefinition; typedef cannot be overloaded with any other symbol
7>  d:\dev\shtilleengine\platform\windows\shtilleengine\physicstest\predefined c++ types (compiler internal)(16): note: see declaration of 'size_t'
linearmath\btvector3.h(87): error C2146: syntax error: missing ';' before identifier 'sizeInBytes'
linearmath\btvector3.h(87): error C2059: syntax error: ')'
linearmath\btvector3.h(87): error C2143: syntax error: missing ';' before '{'
linearmath\btvector3.h(87): error C2447: '{': missing function header (old-style formal list?)
linearmath\btvector3.h(87): warning C4595: 'operator delete[]': non-member operator new or delete functions may not be declared inline
linearmath\btvector3.h(87): error C2143: syntax error: missing ')' before ','
linearmath\btvector3.h(87): error C2086: 'int size_t': redefinition
linearmath\btvector3.h(87): note: see declaration of 'size_t'
linearmath\btvector3.h(87): error C2062: type 'void' unexpected
linearmath\btvector3.h(87): error C2059: syntax error: '}'
linearmath\btvector3.h(102): error C2646: an anonymous union at global or namespace scope must be declared static
linearmath\btvector3.h(104): error C2270: 'get128': modifiers not allowed on nonmember functions
linearmath\btvector3.h(116): error C2059: syntax error: 'public'
linearmath\btvector3.h(119): error C2059: syntax error: ')'
linearmath\btvector3.h(120): error C2143: syntax error: missing ';' before '{'
linearmath\btvector3.h(120): error C2447: '{': missing function header (old-style formal list?)
linearmath\btvector3.h(131): error C2059: syntax error: 'const'
linearmath\btvector3.h(132): error C2143: syntax error: missing ';' before '{'
linearmath\btvector3.h(132): error C2447: '{': missing function header (old-style formal list?)
linearmath\btvector3.h(165): error C2805: binary 'operator +=' has too few parameters
linearmath\btvector3.h(171): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(172): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(173): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(175): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(182): error C2805: binary 'operator -=' has too few parameters
linearmath\btvector3.h(188): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(189): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(190): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(192): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(198): error C2803: 'operator *=' must have at least one formal parameter of class type
linearmath\btvector3.h(198): error C2805: binary 'operator *=' has too few parameters
linearmath\btvector3.h(210): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(216): error C2803: 'operator /=' must have at least one formal parameter of class type
linearmath\btvector3.h(216): error C2805: binary 'operator /=' has too few parameters
linearmath\btvector3.h(229): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(236): error C2270: 'dot': modifiers not allowed on nonmember functions
linearmath\btvector3.h(250): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(251): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(252): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(258): error C2270: 'length2': modifiers not allowed on nonmember functions
linearmath\btvector3.h(259): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(264): error C2270: 'length': modifiers not allowed on nonmember functions
linearmath\btvector3.h(270): error C2270: 'norm': modifiers not allowed on nonmember functions
linearmath\btvector3.h(276): error C2270: 'safeNorm': modifiers not allowed on nonmember functions
linearmath\btvector3.h(286): error C2270: 'distance2': modifiers not allowed on nonmember functions
linearmath\btvector3.h(290): error C2270: 'distance': modifiers not allowed on nonmember functions
linearmath\btvector3.h(294): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(294): error C2227: left of '->absolute' must point to class/struct/union/generic type
linearmath\btvector3.h(295): error C2039: 'maxAxis': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(296): error C2676: binary '[': 'btVector3' does not define this operator or a conversion to a type acceptable to the predefined operator
linearmath\btvector3.h(298): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(298): error C2676: binary '[': 'btVector3' does not define this operator or a conversion to a type acceptable to the predefined operator
linearmath\btvector3.h(299): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(301): error C3861: 'setValue': identifier not found
linearmath\btvector3.h(302): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(310): error C3861: 'fuzzyZero': identifier not found
linearmath\btvector3.h(348): error C2355: 'this': can only be referenced inside non-static member functions or non-static data member initializers
linearmath\btvector3.h(353): error C2270: 'normalized': modifiers not allowed on nonmember functions
linearmath\btvector3.h(358): error C2270: 'rotate': modifiers not allowed on nonmember functions
linearmath\btvector3.h(363): error C2270: 'angle': modifiers not allowed on nonmember functions
linearmath\btvector3.h(364): error C2039: 'length2': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(371): error C2270: 'absolute': modifiers not allowed on nonmember functions
linearmath\btvector3.h(381): error C2440: '<function-style-cast>': cannot convert from 'initializer list' to 'btVector3'
linearmath\btvector3.h(381): note: No constructor could take the source type, or constructor overload resolution was ambiguous
linearmath\btvector3.h(388): error C2270: 'cross': modifiers not allowed on nonmember functions
linearmath\btvector3.h(420): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(421): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(422): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(427): error C2270: 'triple': modifiers not allowed on nonmember functions
linearmath\btvector3.h(470): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(471): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(472): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(479): error C2270: 'minAxis': modifiers not allowed on nonmember functions
linearmath\btvector3.h(486): error C2270: 'maxAxis': modifiers not allowed on nonmember functions
linearmath\btvector3.h(491): error C2270: 'furthestAxis': modifiers not allowed on nonmember functions
linearmath\btvector3.h(492): error C2039: 'minAxis': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(496): error C2270: 'closestAxis': modifiers not allowed on nonmember functions
linearmath\btvector3.h(497): error C2039: 'maxAxis': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(519): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(520): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(521): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(531): error C2270: 'lerp': modifiers not allowed on nonmember functions
linearmath\btvector3.h(548): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(549): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(550): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(557): error C2805: binary 'operator *=' has too few parameters
linearmath\btvector3.h(563): error C2039: 'm_floats': is not a member of 'btVector3'
linearmath\btvector3.h(83): note: see declaration of 'btVector3'
linearmath\btvector3.h(563): fatal error C1003: error count exceeds 100; stopping compilation
I simply wrote this code into target application:

Code: Select all

#include "LinearMath\btDefaultMotionState.h"
...
btDefaultMotionState ms;
It seems that macro BT_DECLARE_ALIGNED_ALLOCATOR(); causes some errors. Don't know why.
Any suggestions of proper library usage under Windows platform?
Shtille
Posts: 8
Joined: Sat Jan 21, 2017 5:08 pm

Re: Errors with Visual Studio compilation

Post by Shtille »

I've found the reason of that issue. I forgot that i've been using MSVC memory check:

Code: Select all

#include <crtdbg.h>

#define DEBUG_CLIENTBLOCK   new( _CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_CLIENTBLOCK
Thus I strongly recommend to add some lines into btScalar.h like these:

Code: Select all

#ifdef new
#error You shouldn't have new operator redefined
#endif
So you can close this topic.
Post Reply