Eclipse CDT C ++ enum "failed to resolve"

I am developing a game in Eclipse CDT in C ++ / OpenGL, and it compiles and works very well, but for some reason the declared enum (SCREEN_MAIN_MENU) is underlined by red squiggles and highlighting it, says that Symbol SCREEN_MAIN_MENU may not be resolved. This is a blatant lie, how can I make Eclipse recognize it?

Screens.h:

#ifndef SCREENS_H
#define SCREENS_H

enum {
SCREEN_MAIN_MENU,
SCREEN_LOADING,
SCREEN_GAME
};

class Screen{
public:
    static void change(int screen);
    static void render();
};

#endif

Screens.cpp:

#include "screens.h"
#include "gui.h"
#include "global.h"

extern Global global;

void Screen::change(int screen){
    global.screen = screen;
}

void Screen::render(){
if(global.screen == SCREEN_MAIN_MENU){ //HERE ARE THE RED SQUIGGLES!!!??
    global.text_renderer.print("Sidona", global.screen_width/2-40,
    global.screen_height-25);
    Gui::render();
    }
}
+5
source share
2 answers

This may be caused by an error in the Eclipse CDT:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=356057

Try rebuilding the index (right click on the project -> Index -> Rebuild)

+13
source

Have you tried creating a named type for enumeration?

i.e.

enum SCREEN_TYPE {  SCREEN_MAIN_MENU, SCREEN_LOADING, SCREEN_GAME };
0
source

All Articles