• Create Account

### #Actualharshman_chris

Posted 17 January 2013 - 10:25 AM

I like warning free code, especially for a dll, these warnings are the only left right now I have to deal with. I am not sure how to deal with them however. If someone could point me in the right direction that would be great.

std::basic_string<_Elem,_Traits,_Ax>
std::map<_Kty,_Ty>
std::vector<_Ty>
std::list<_Ty>'
std::_List_iterator<_Mylist>

Update:

So to compound this, I get this error when setting up my .exe project:

Error 49 error C2491: 'ParticlesEngine::Singleton<T>::instance' : definition of dllimport static data member not allowed

The Code:

#ifndef _SINGLETON_H
#define _SINGLETON_H

#define NULL 0

#ifdef PARTICLESENGINE_DLL
#define PARTICLESENGINE_API __declspec( dllexport )
#else
#define PARTICLESENGINE_API __declspec( dllimport )
#endif

namespace ParticlesEngine
{

template <typename T>
class PARTICLESENGINE_API Singleton
{
public:
Singleton<T>(void)
{
}

static inline T* getInstance(void)
{
if(instance == NULL)
{
instance = new T();
}
return instance;
}

static inline bool exists( void ) { return instance != 0; }

virtual ~Singleton( void ) { instance = 0; }

protected:
static T* instance;
};

template <typename T>
T* Singleton<T>::instance = 0;

}

#endif

### #1harshman_chris

Posted 17 January 2013 - 09:55 AM

I like warning free code, especially for a dll, these warnings are the only left right now I have to deal with. I am not sure how to deal with them however. If someone could point me in the right direction that would be great.

std::basic_string<_Elem,_Traits,_Ax>
std::map<_Kty,_Ty>
std::vector<_Ty>
std::list<_Ty>'
std::_List_iterator<_Mylist>

PARTNERS