ciao , non riesco a capire perchč , ma ho definito in una classe CRender un enum , cosi:
e vorrei utilizzarla in un altra classe Camera:codice:class CRenderer{ public: enum CameraBehavior { CAMERA_BEHAVIOR_FIRST_PERSON, CAMERA_BEHAVIOR_SPECTATOR, CAMERA_BEHAVIOR_FLIGHT, CAMERA_BEHAVIOR_ORBIT };
ma l'assegnamento non va a buon finecodice: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;
e mi da quest errore:
come posso condividere un enum tra piu classi ? forse mettendolo in un namespace?codice:Unhandled exception at 0x000000013F7F7EB9 in qtgltest.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
č 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?

Rispondi quotando