ciao , non riesco a capire perchè , ma ho definito in una classe CRender un enum , cosi:
codice:
class CRenderer{
public:
enum CameraBehavior
{
CAMERA_BEHAVIOR_FIRST_PERSON,
CAMERA_BEHAVIOR_SPECTATOR,
CAMERA_BEHAVIOR_FLIGHT,
CAMERA_BEHAVIOR_ORBIT
};
e vorrei utilizzarla in un altra classe Camera:
codice:
void Camera::setBehavior(CRenderer::CameraBehavior newBehavior)
{
// Switch to a new camera mode (i.e., behavior).
// This method is complicated by the fact that it tries to save the current
// behavior's state prior to making the switch to the new camera behavior.
// Doing this allows seamless switching between camera behaviors.
CRenderer::CameraBehavior prevBehavior;
prevBehavior = m_behavior;-------------------------------->errore
if (prevBehavior == newBehavior)
return;
//m_behavior è una variabile membro della classe Camera cosi:
//CRenderer::CameraBehavior m_behavior;
ma l'assegnamento non va a buon fine
e mi da quest errore:
codice:
Unhandled exception at 0x000000013F7F7EB9 in qtgltest.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
come posso condividere un enum tra piu classi ? forse mettendolo in un namespace?
è li l'errore?
perchè non capisco l'errore che mi da vs 2012
grazie.
ps. ho provato a mettere l'enum in un namespace ma quando faccio
OPEN::ENUMS::CameraBehavior camBea=OPEN::ENUMS::CameraBehavior::CAMERA_BEHAVIO R_ORBIT;
ottengo un numero del tipo 2349238432948209
potrebbe essere un problema di dll e .lib in cui ho diviso il programma?