Author Topic: Error, please help  (Read 1407 times)

Chewbaca427

  • Guest
Error, please help
« on: August 02, 2012, 07:32:13 pm »
I keep getting this error and I don't know what I did wrong.
error is : c:\dragonfiresdk\menu\app.cpp(31): error C2065: 'OnButtonUp' : undeclared identifier
Code: [Select]
#include "DragonFireSDK.h"

int Background2;
int SpaceMarinesBackground;
int BannerLocation=1;
int Background;
int ButtonDown;
int ButtonUp;
int ButtonBloodAngels;
int ButtonChaosDaemons;
int ButtonChaosSpaceMarines;
int ButtonDarkEldar;
int ButtonEldar;
int ButtonGreyKnights;
int ButtonImperialGuard;
int ButtonNecrons;
int ButtonOrks;
int ButtonSistersofBattle;
int ButtonSpaceMarines;
int ButtonSpaceWolves;
int ButtonTauEmpire;
int ButtonTyranids;


int OnButtonDown(int value)
{
switch(value)
{
case 1:
Background2=ViewAdd("Images/Background.png", 0, 0);
ButtonUp=ButtonAdd("Images/Button_Up", 0, 0, OnButtonUp, 1);
break;
}
return 1;
}
int OnButtonUp(int value)
{
switch(value)
{
case 1:
ViewSetVisible(Background2, 0);
ButtonSetVisible(ButtonUp, 0);
break;
}
return 1;
}
int OnButtonBloodAngels(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonChaosDaemons(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonChaosSpaceMarines(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonDarkEldar(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonEldar(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonGreyKnights(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonImperialGuard(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonNecrons(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonOrks(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonSistersofBattle(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonSpaceMarines(int value)
{
switch(value)
{
case 1:
SpaceMarinesBackground=ViewAdd("Images/SpaceMarinesBackground.png", 0, 0);
break;
}
return 1;
}
int OnButtonSpaceWolves(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonTauEmpire(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
int OnButtonTyranids(int value)
{
switch(value)
{
case 1:

break;
}
return 1;
}
void AppMain()
{
Background=ViewAdd("Images/Background.png", 0, 0);
ButtonDown=ButtonAdd("Images/Button_Down", 0, 400, OnButtonDown, 1);
ButtonBloodAngels=ButtonAdd("Images/Button_BloodAngels", 0, 0, OnButtonBloodAngels, 1);
ButtonChaosDaemons=ButtonAdd("Images/Button_ChaosDaemons", 0, 40, OnButtonChaosDaemons, 1);
ButtonChaosSpaceMarines=ButtonAdd("Images/Button_ChaosSpaceMarines", 0, 80, OnButtonChaosSpaceMarines, 1);
ButtonDarkEldar=ButtonAdd("Images/Button_DarkEldar", 0, 120, OnButtonDarkEldar, 1);
ButtonEldar=ButtonAdd("Images/Button_Eldar", 0, 160, OnButtonEldar, 1);
ButtonGreyKnights=ButtonAdd("Images/Button_GreyKnights", 0, 200, OnButtonGreyKnights, 1);
ButtonImperialGuard=ButtonAdd("Images/Button_ImperialGuard", 0, 240, OnButtonImperialGuard, 1);
ButtonNecrons=ButtonAdd("Images/Button_Necrons", 0, 280, OnButtonNecrons, 1);
ButtonOrks=ButtonAdd("Images/Button_Orks", 0, 320, OnButtonOrks, 1);
ButtonSistersofBattle=ButtonAdd("Images/Button_SistersofBattle", 0, 360, OnButtonSistersofBattle, 1);



AdBannerInit(BannerLocation);
}

void AppExit()
{

}

void OnTimer()
{

}

tim

  • Administrator
  • Hero Member
  • *****
  • Posts: 1595
  • Karma: +11/-1
    • View Profile
    • DragonFireSDK
Re: Error, please help
« Reply #1 on: August 03, 2012, 01:03:12 pm »
Move your declaration of the OnButtonUp() function to before the place where you are referencing it.  The compiler starts at the top of the source file and if you reference some identifier before it is declared, the compiler gets confused...
Tim Sommers
DragonFireSDK Team

Chewbaca427

  • Guest
Re: Error, please help
« Reply #2 on: August 03, 2012, 02:49:43 pm »
alight thanks:3

Nico91

  • Guest
Re: Error, please help
« Reply #3 on: September 20, 2012, 03:51:31 pm »
I suggest you to insert alle the Add (for example ViewAdd or TextAdd) in the AppMain function.