public const btVector in class header file

User avatar
leo
Posts: 11
Joined: Fri Apr 17, 2009 4:12 pm
Location: europe

public const btVector in class header file

Post by leo »

Hi there,

I'm trying to create a public const btVector3 in a class header. Somehow it did not work because the btVector3 is not a native C++ variable...

Code: Select all

#include "btBulletDynamicsCommon.h"

#ifndef Test_H_
#define Test_H_

class Test
{
public:
	Test();		// constructor
	~Test();		// destructor

        const static int a = 1;

private:
	....
with the integer a for example it works fine. But how do I have to declare the btVector3?

Thanks for any help

Cheers Leo
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: public const btVector in class header file

Post by Dirk Gregorius »

This only works for integers in headers. For btVector3 you have to do this:

// Header (Test.h)
class Test
{
public: static const btVector3 myVector;
}

// Implementation (Test.cpp)
const btVector3 Test::myVector( 1,1,1 );
User avatar
leo
Posts: 11
Joined: Fri Apr 17, 2009 4:12 pm
Location: europe

Re: public const btVector in class header file

Post by leo »

A late 'thanks' to Dirk!

:oops: Leo