Error compiling opensource

  • tugrul_512bit
    6th Feb 2014 Member 0 Permalink

    What is the rule of adding "a new header" ? Adding just an extra include completely purges compilation. What must I do when I change air.h ?

     

    When I did everything on tutorial for windows, it compiled fine and worked ok, then I added some classes and compiled again and that worked too, but today its giving an error and I only made air.h include Aux_cl of mine. I did not touch that class or any relevant classes.

     

     

    Error 1 error C2039: 'GetUserNameA' : is not a member of 'SaveInfo'

    C:\Users\Tugrul_Asli\Desktop\powdertoy\The-Powder-Toy-develop\src\gui\game\GameController.cpp 1308 1 powderGPU

     

    why is this giving error but did give any before? Also even if I slightly change air.h(adding a new include of mine "Aux_cl.h"), it says "illegal token on the right side of '::'" for the min max for bitmapbrush.h. Whats going on?

     

    if(gameModel->GetSave() && gameModel->GetUser().ID && gameModel->GetUser().Username == gameModel->GetSave()->GetUserName())
    {
    Simulation * sim = gameModel->GetSimulation();
    GameSave * gameSave = sim->Save();
    gameSave->paused = gameModel->GetPaused();
    gameSave->gravityMode = sim->gravityMode;
    gameSave->airMode = sim->air->airMode;
    gameSave->legacyEnable = sim->legacy_enable;
    gameSave->waterEEnabled = sim->water_equal_test;
    gameSave->gravityEnable = sim->grav->ngrav_enable;
    gameSave->aheatEnable = sim->aheat_enable;
    if(!gameSave)
    {
    new ErrorMessage("Error", "Unable to build save.");
    }
    else
    {
    if(gameModel->GetSave())
    {
    SaveInfo tempSave(*gameModel->GetSave());
    tempSave.SetGameSave(gameSave);
    new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
    }
    else
    {
    SaveInfo tempSave(0, 0, 0, 0, gameModel->GetUser().Username, "");
    tempSave.SetGameSave(gameSave);
    new ServerSaveActivity(tempSave, true, new SaveUploadedCallback(this));
    }
    }
    }
    else if(gameModel->GetUser().ID)
    {
    OpenSaveWindow();
    }
    else
    {
    new ErrorMessage("Error", "You need to login to upload saves.");
    }

    Edited 3 times by tugrul_512bit. Last: 6th Feb 2014
  • jacksonmj
    6th Feb 2014 Developer 0 Permalink

    Does one of your headers include something like stdafx.h or windows.h? I believe one of the windows headers defines GetUserName to be GetUserNameA (which should only affect the relevant Windows API function, but since Powder Toy uses it as the name for a member function the define causes problems for Powder Toy).

     

    If so, either don't include the stdafx.h/windows.h/whatever header (this is the best way) or try adding "#undef GetUserName" to your header after the relevant include.

     

    Similarly for BitmapBrush.h, one of the windows headers is probably defining min and max to be something unhelpful. Either don't include the header or add "#undef min", "#undef max".

    Edited 3 times by jacksonmj. Last: 6th Feb 2014
  • tugrul_512bit
    6th Feb 2014 Member 0 Permalink

    @jacksonmj (View Post)

     

    Edit: solved the problem. There is another problem:

     

    Air::Air(Simulation & simulation): is not being called by anything. I suspect air simulation is not working. Cout does not print anything to cconsole even if I flush it. Even if I run from console or msvc. Doesnt print anything.

     

    In KernelIngredients.cpp there is only #include "KernelIngredients.h"

     

    In KernelIngredients.h there is no inclusion

     

    In ClKernelFactory.h there is only #include "KernelIngredients.h"

     

    In ClKernelFactory.cpp there is only #include "ClKernelFactory.h"

     

    In Aux_cl.cpp there is only #include "Aux_cl.h"

     

    In Aux_cl.h there are only opencl inclusions (i wish these dont use the windows things you say :S )

     

    In Air.h there are  #include "Aux_cl.h" and #include"ClKernelFactory.h"

     

    How can I envelop those opencl things with #def and #undef to protect other files such from this?

    Edited 2 times by tugrul_512bit. Last: 6th Feb 2014