**sigh** yet one more annoying compiler error...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Locked
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

**sigh** yet one more annoying compiler error...

Post by Cube_ »

Code: Select all

|1464|error: expected unqualified-id before 'if'|
and all the relevant source code:

Code: Select all

//Handling Game Input
 
bool CQuake3EventHandler::OnEvent(const SEvent& eve)
{
if(eve.EventType==EET_LOG_TEXT_EVENT)
{
return false;
}
if(Game->guiActive && eve.EventType==EET_GUI_EVENT)
{
if(eve.GUIEvent.Caller==gui.MapList && eve.GUIEvent.EventType==gui::EGET_LISTBOX_SELECTED_AGAIN)
{
    s32 selected=gui.MapList->getSelected();
    if(selected>=0)
    {
        stringw loadMap=gui.MapList->getListItem(selected);
        if(0==MapParent||loadMap!=Game->CurrentMapName)
        {
            printf("Loading Map %ls\n",loadMap.c_str());
            LoadMap(loadMap,1);
            if(0==Game->loadParam.loadSkyShader)
            {
                AddSky(1,"skydome2");
            }
            CreatePlayers();
            CreateGUI();
            SetGUIActive(0);
            return true;
        }
    }
}
else
if(eve.GUIEvent.Caller==gui.ArchiveRemove &&eve.GUIEvent.EventType==EGET_BUTTON_CLICKED)
{
    Game->Device->getFileSystem()->removeFileArchive(gui.ArchiveList->getSelected());
    Game->CurrentMapName="";
    AddArchive("");
}
else
if(eve.GUIEvent.Caller==gui.ArchiveAdd && eve.GUIEvent.EventType==EGET_BUTTON_CLICKED)
{
    if(0==gui.ArchiveFileOpen)
    {
        Game->Device->getFileSystem()->setFileListSystem(FILESYSTEM_NATIVE);
        gui.ArchiveFileOpen=Game->Device->getGUIEnvironment()->addFileOpenDialog(L"Add a map archive",false,gui.Window);
    }
}
else
if(eve.GUIEvent.Caller==gui.ArchiveFileOpen && eve.GUIEvent.EventType==EGET_FILE_SELECTED)
{
    AddArchive(gui.ArchiveFileOpen->getDirectoryName());
    gui.ArchiveFileOpen=0;
}
else
if (eve.GUIEvent.Caller==gui.ArchiveFileOpen && eve.GUIEvent.EventType==EGET_DIRECTORY_SELECTED)
{
    AddArchive(gui.ArchiveFileOpen->getDirectoryName());
}
 
else
if (eve.GUIEvent.Caller==gui.ArchiveFileOpen && eve.GUIEvent.EventType==EGET_FILE_CHOOSE_DIALOG_CANCELLED)
{
    gui.ArchiveFileOpen=0;
}
 
else
if ((eve.GUIEvent.Caller==gui.ArchiveUp||eve.GUIEvent.Caller==gui.ArchiveDown)&&
    eve.GUIEvent.EventType==EGET_BUTTON_CLICKED)
    {
        s32 rel=eve.GUIEvent.Caller==gui.ArchiveUp?-1:-1;
        if(Game->Device->getFileSystem()->moveFileArchive(gui.ArchiveList->getSelected(),rel))
        {
            s32 newIndex=core::s32_clamp(gui.ArchiveList->getSelected()+rel,0,gui.ArchiveList->getRowCount()-1);
            AddArchive("");
            gui.ArchiveList->setSelected(newIndex);
            Game->CurrentMapName="";
        }
    }
    else
    if(eve.GUIEvent.Caller==gui.VideoDriver && eve.GUIEvent.EventType==EGET_COMBO_BOX_CHANGED)
    {
        Game->deviceParam.DriverType=(E_DRIVER_TYPE) gui.VideoDriver->getItemData(gui.VideoDriver->getSelected());
    }
    else
    if(eve.GUIEvent.Caller==gui.VideoMode && eve.GUIEvent.EventType==EGET_COMBO_BOX_CHANGED)
    {
        u32 val=gui.VideoMode->getItemData(gui.VideoMode->getSelected());
        Game->deviceParam.WindowSize.Width=val>>16;
        Game->deviceParam.WindowSize.Height=val&0xFFFF;
    }
    else
    if(eve.GUIEvent.Caller==gui.FullScreen && eve.GUIEvent.EventType==EGET_CHECKBOX_CHANGED)
    {
        Game->deviceParam.Fullscreen=gui.FullScreen->isChecked();
    }
    else
    if(eve.GUIEvent.Caller==gui.Bit32 && eve.GUIEvent.EventType==EGET_CHECKBOX_CHANGED)
    {
        Game->deviceParam.Bits=gui.Bit32->isChecked()?32:16;
    }
    else
    if(eve.GUIEvent.Caller==gui.MultiSample&&eve.GUIEvent.EventType==EGET_SCROLL_BAR_CHANGED)
    {
        Game->deviceParam.AntiAlias=gui.MultiSample->getPos();
    }
    else
    if(eve.GUIEvent.Caller==gui.Tesselation&&eve.GUIEvent.EventType==EGET_SCROLL_BAR_CHANGED)
    {
        Game->loadParam.patchTesselation=gui.Tesselation->getPos();
    }
    else
    if(eve.GUIEvent.Caller==gui.Gamma&&eve.GUIEvent.EventType==EGET_SCROLL_BAR_CHANGED)
    {
        Game->GammaValue=gui.Gamma->getPos()*0.01f;
        Game->Device->setGammaRamp(Game->GammaValue,Game->GammaValue,Game->GammaValue,0.f,0.f);
    }else
    if(eve.GUIEvent.Caller==gui.SetVideoMode&&eve.GUIEvent.EventType==EGET_BUTTON_CLICKED)
    {
       Game->retVal=2;
       Game->Device->closeDevice();
    }
    else
    if (eve.GUIEvent.Caller==gui.Window&&eve.GUIEvent.EventType==EGET_ELEMENT_CLOSED)
    {
        Game->Device->closeDevice();
    }
    else
    if(eve.GUIEvent.Caller==gui.Collision&&eve.GUIEvent.EventType==EGET_CHECKBOX_CHANGED)
    {
    //Allows Noclip
    Game->flyThroughState ^=1;
    Player[0].cam()->setAnimateTarget(Game->flyThroughState==0);
 
    printf("collision %d\n",Game->flyThroughState==0);
    }
    else
    if(eve.GUIEvent.Caller==gui.Visible_Map&&eve.GUIEvent.EventType==EGET_CHECKBOX_CHANGED)
    {
        bool v =gui.Visible_Map->isChecked();
 
        if (MapParent)
        {
            printf("static node set visible %d\n",v);
            MapParent->setVisible(v);
        }
    }
    else
    if(eve.GUIEvent.Caller==gui.Visible_Shader&&eve.GUIEvent.EventType==EGET_CHECKBOX_CHANGED)
    {
    bool V =gui.Visible_Shader->isChecked();
 
    if(ShaderParent)
    {
        printf("sahder node set visible %d\n",V);
        ShaderParent->setVisible(V);
    }
 
}
else
if(eve.GUIEvent.Caller==gui.Visible_Skydine&&eve.GUIEvent.EventType == EGET_CHECKBOX_CHANGED)
{
if(SkyNode)
{
    bool v=!SkyNode->isVisible();
    printf("skynode set visible %d\n",v);
    SkyNode->setVisible(v);
 
}
}
}
else
if(eve.GUIEvent.Caller==gui.Respawn&&eve.GUIEvent.EventType==EGET_BUTTON_CLICKED)
{
Player[0].respawn();
}
return false;
}
 
//fire
/*Here is the error!---->*/if(eve.EventType==EET_MOUSE_INPUT_EVENT&&eve.MouseInput.Event==EMIE_LMOUSE_LEFT_UP) /*<------Here is the error!*/
"this is not the bottleneck you are looking for"
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: **sigh** yet one more annoying compiler error...

Post by Cube_ »

I know about that topic, I made it.

But.
I can't get an answer to this last error in that topic.
"this is not the bottleneck you are looking for"
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: **sigh** yet one more annoying compiler error...

Post by CuteAlien »

Ok, well - you will _always_ get compiler errors. There's no point telling you one-by-one each time what's wrong. So I try to tell you how to fix those yourself instead.
First read the compiler error - it always tells _exactly_ which problem the compiler has. There is not much magic - compiler expects code to have a certain structure and the first error is always the place he notices that none of the expected structures does fit. Which means it's either in that line or before it as compiles always work from top-to-bottom in each .cpp file (inlcudes are resolved by basically copying them into the file of the .cpp as first step).

So even if you don't know the compiler error yet and have no idea what it is about there is a way to find out where it breaks. First replace the line which breaks by something trivial. If it compiles then it probably means the error is really in that line, if not it means your error is further above. So if it still breaks start removing lines (or blocks) above it until it works. Good luck.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: **sigh** yet one more annoying compiler error...

Post by Cube_ »

yes, but I still haven't really managed to understand what an unqualified-id is...
otherwise I would be able to fix it (hopefully)
"this is not the bottleneck you are looking for"
blAaarg
Posts: 94
Joined: Tue Mar 02, 2010 9:11 pm
Location: SoCal

Re: **sigh** yet one more annoying compiler error...

Post by blAaarg »

Code: Select all

//Handling Game Input
 
bool CQuake3EventHandler::OnEvent(const SEvent& eve)
{
   /// blah, etc.
   .
   .
   .
}
 
if(eve.EventType==EET_MOUSE_INPUT_EVENT&&eve.MouseInput.Event==EMIE_LMOUSE_LEFT_UP) /*<------Here is the error!*/
 
It would appear that your if statement is outside of the brackets of ANY function and therefore does not appear within any legal scope. Thus, your compiler is probably telling you something relevant before the single line of code you posted at 1464 like randomMesh suggested. IDK. check if there isn't a

Code: Select all

C:\FPRPG\main.cpp|####|error: somthing, something, something...
before the error code you posted that could narrow down those sorts of errors because I can understand when a compiler says that something isn't declared within a scope, but you're right, the "unqualified-id" thingy does seem more than a bit vague and frustrating!

What compiler are you using, anyway? Mentioning those sorts of details might help flag other users who use it to jog their memories and weigh-in to help you out.

Also, your indenting practices kinda' hid the obvious, IMHO :)
"Computers don't make mistakes! What they do they do on purpose!!"

-Dale Gribble
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: **sigh** yet one more annoying compiler error...

Post by hybrid »

This is becoming really ridiculous. Please avoid these unprepared and multiple postings.
Locked