Hack Forums
[C] Keep getting this error while compiling GTA IV Mod Menu - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Keep getting this error while compiling GTA IV Mod Menu (/showthread.php?tid=4905764)



Keep getting this error while compiling GTA IV Mod Menu - RxQueen - Jul 13, 2015

[/quote]Hey all, I keep getting this error from the compiler when trying to compile my GTA IV Mod loader.

Design.c(8): error line: 8 compiler: nested functions are disabled, use -fnested-functions to re-enable

I'm really stumped with this I don't have a clue what's wrong as it's compiling a pre-edited version.

I did not edit the Design.c

I would really appreciate it if someone could help me out with this

Code:
/
Menu core
by: Herr Muskelprotze

/

void do_menu(void)
{
if (show_menu)
{
float pos_y = start_y;

draw_title(0.5, 0.05, 0.6, 0.98, s_r, s_g, s_b, 255, MENU_TITLE);

set_up_draw(3, 0.35, 0.35, 255, 255, 255, 255);
draw_text("STRING", 0.05, 0.975, footer);

uint i = 1;
for (i; i <= item_count; i++){
r = 255;
g = 255;
b = 255;
a = 255;
pos_y = pos_y + 0.0375;
if (item_select == i){
r = s_r;
g = s_g;
b = s_b;
}
if (menu[i].type == 1){
if (menu[i].value){
set_up_draw(3, 0.35, 0.35, s_r, s_g, s_b, a);
draw_text("STRING", (pos_x + 0.3), pos_y, "On");
}
else{
set_up_draw(3, 0.35, 0.35, 255, 255, 255, a);
draw_text("STRING", (pos_x + 0.3), pos_y, "Off");
}
}
if (menu[i].type == 2){
set_up_draw(3, 0.35, 0.35, s_r, s_g, s_b, a);
draw_text("STRING", (pos_x + 0.3), pos_y, "(");

set_up_draw(3, 0.35, 0.35, 255, 255, 255, a);
draw_number("NUMBR", (pos_x + 0.305), pos_y, menu[i].value);

set_up_draw(3, 0.35, 0.35, s_r, s_g, s_b, a);
if (menu[i].value > 99)
draw_text("STRING", (pos_x + 0.345), pos_y, ")");
else if (menu[i].value > 9)
draw_text("STRING", (pos_x + 0.33), pos_y, ")");
else
draw_text("STRING", (pos_x + 0.315), pos_y, ")");
}
if (menu[i].type == 3){
set_up_draw(3, 0.35, 0.35, r, g, b, a);
draw_text("STRING", pos_x, pos_y, GET_STRING_FROM_TEXT_FILE(GET_DISPLAY_NAME_FROM_VEHICLE_MODEL(menu[i].value)));
}
else{
set_up_draw(3, 0.35, 0.35, r, g, b, a);
draw_text("STRING", pos_x, pos_y, menu[i].item_name);
}
}



///Buttons
if (IS_BUTTON_JUST_PRESSED(0, DPAD_UP)){
if (item_select == 1){
item_select = item_count;
}
else item_select--;
}
else if (IS_BUTTON_JUST_PRESSED(0, DPAD_DOWN)){
if (item_select == item_count){
item_select = 1;
}
else item_select++;
}
else if (IS_BUTTON_JUST_PRESSED(0, DPAD_RIGHT) && menu[item_select].type == 2){
if (menu[item_select].value == menu[item_select].maxval)
menu[item_select].value = 1;
else
menu[item_select].value += 1;
}
else if (IS_BUTTON_JUST_PRESSED(0, DPAD_LEFT) && menu[item_select].type == 2){
if (menu[item_select].value == 1)
menu[item_select].value = menu[item_select].maxval;
else
menu[item_select].value -= 1;
}
else if (IS_BUTTON_JUST_PRESSED(0, BUTTON_A)){
if (menu[item_select].action){
menu_functions();
}
else{
uint i = 1;
for (i; i <= item_count; i++){
menu[i].action = false;
menu[i].type = 0;
}
last_selected[menu_level] = item_select;
menu_level++;
menu_setup();
item_select = 1;
}
}
else if (IS_BUTTON_JUST_PRESSED(0, BUTTON_B)){
if (menu_level > 0){
uint i = 1;
for (i; i <= item_count; i++){
menu[i].action = false;
menu[i].type = 0;
}
menu_level--;
item_select = last_selected[menu_level];
menu_setup();
}
else menu_shutdown();
}

}
else if (IS_BUTTON_PRESSED(0, BUTTON_X) && IS_BUTTON_JUST_PRESSED(0, DPAD_LEFT))
{
menu_startup();
}
}


* - TheComet - Jul 13, 2015

Have you tried reading the error message and adding -fnested-functions to the compiler options?


* - Kantos - Jul 13, 2015

Please enclose code using the code tags.

Secondly, the error message is telling you exactly what's wrong (even though I don't see any nested functions in the code). If that's the entire file, try removing the 'void' from the parameters in the do_menu definition. If there's actually a nested function, then do what TheComet said and compile using -fnested-functions