Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse CDT C++ enum "could not be resolved"

I'm developing a game in Eclipse CDT in C++/OpenGL, and it compiles and runs just fine, but for some reason an enum I'm declaring (SCREEN_MAIN_MENU) gets underlined in red squiggles and highlighting it says Symbol SCREEN_MAIN_MENU could not be resolved. This is a blatant lie, how do I get Eclipse to 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();
    }
}
like image 797
Eric B Avatar asked Aug 08 '12 14:08

Eric B


1 Answers

This may be caused by a bug in Eclipse CDT:

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

Try to rebuild the index (Right click on the project -> Index -> Rebuild)

like image 140
josias Avatar answered Sep 24 '22 14:09

josias