我正在尝试编译我的C代码,但我收到了这个错误,我已经重新查看了所有代码,但我无法看到错误,但我不知道#39;我确切地知道这个错误是什么,因为我之前从未见过它,如果有人可以帮助我,我会非常推荐它。
C:\Users\Eahz\Desktop\scocl\workspace\xmc\/menu_functions.cpp(2034): error line: 2034 compiler: nested functions are disabled, use -fnested-functions to re-enable
第2034行的代码是:
void looped_functions(void){
//player options
SET_CHAR_INVINCIBLE(pPlayer,godmode);
if(pprotection){
uint pos[4];
GET_POSITION_OF_ANALOGUE_STICKS(0,&pos[0],&pos[1],&pos[2],&pos[3]);
if(pos[0] == 0 && pos[1] == 0)
FREEZE_CHAR_POSITION(pPlayer,true);
else
FREEZE_CHAR_POSITION(pPlayer,false);
}
if(rocketpistol){
if(IS_CHAR_IN_ANY_CAR(pPlayer)){
GET_CAR_CHAR_IS_USING(pPlayer,&tmp);
GET_CAR_MODEL(tmp,&model);
if(!IS_THIS_MODEL_A_HELI(model) && !IS_THIS_MODEL_A_BIKE){
GET_CHAR_IN_CAR_PASSENGER_SEAT(tmp,1,&tmp_ped[0]);
GET_DRIVER_OF_CAR(tmp,&tmp_ped[1]);
if(tmp_ped[0] == pPlayer || tmp_ped[1] == pPlayer)
bone = BONE_LEFT_HAND;
}
}
else bone = BONE_RIGHT_HAND;
GET_PED_BONE_POSITION(pPlayer,bone,2.0,0.0,0.0,&play_tmp);
GET_PED_BONE_POSITION(pPlayer,bone,100.0,0.0,0.0,&aim_tmp);
if(IS_CHAR_SHOOTING(pPlayer)){
GET_CURRENT_CHAR_WEAPON(pPlayer,&wWeapon);
fire_projectile(wWeapon);
}
projectile_action();
}
if(superrun){
if(!IS_CHAR_IN_ANY_CAR(pPlayer)){
if(IS_BUTTON_PRESSED(0,BUTTON_LB) && IS_BUTTON_PRESSED(0,BUTTON_A)){
APPLY_FORCE_TO_PED(pPlayer,true,0.0,100.0,0.0,0.0,0.0,0.0,true,true,true,true);
}
}
}
if(superjump){
if(!IS_CHAR_IN_ANY_CAR(pPlayer)){
if(IS_BUTTON_PRESSED(0,BUTTON_LB) && IS_BUTTON_PRESSED(0,BUTTON_X)){
APPLY_FORCE_TO_PED(pPlayer,true,0.0,0.0,20.0,0.0,0.0,0.0,true,true,true,true);
}
}
}
if(fastreload){
SET_PLAYER_FAST_RELOAD(GetPlayerIndex(), true);
}
if(forcefield){
float x,y,z;
GET_CHAR_COORDINATES(pPlayer,&x,&y,&z);
ADD_EXPLOSION(x,y,z,EXPLOSION_SHIP_DESTROY,10.0,false,true,0.0);
}
if(hydrolics){
if(IS_BUTTON_PRESSED(0,BUTTON_X))
{
Vehicle PlayerVehicle;
if (IS_CHAR_IN_ANY_CAR(GetPlayerPed()))
{
GET_CAR_CHAR_IS_USING(GetPlayerPed(), &PlayerVehicle);
if((!IS_CHAR_IN_ANY_BOAT(GetPlayerPed())) && (!IS_CHAR_IN_ANY_HELI(GetPlayerPed())))
{
if (IS_VEHICLE_ON_ALL_WHEELS( PlayerVehicle ))
{
APPLY_FORCE_TO_CAR(PlayerVehicle, 0.0f, 0.0f, 0.0f, 60.0f , 0.0f,0.0f,-60.0f, 0, 1, 1, 1 );
//APPLY_FORCE_TO_CAR(PlayerVehicle, 0, x,y, z, spinX, spinY, spinZ, 0, 1, 1, 1);
}
}
}
}
}
if(invisible){
SET_CHAR_VISIBLE(pPlayer, false);
}
else{
SET_CHAR_VISIBLE(pPlayer, true);
}
if(chaos){
float dX,dY,dZ;
GET_CHAR_COORDINATES(GetPlayerPed(),&dX, &dY, &dZ);
ClosestCar = GET_CLOSEST_CAR(dX,dY,dZ, 15, false, 70);
if( DOES_VEHICLE_EXIST(ClosestCar))
{
APPLY_FORCE_TO_CAR(ClosestCar, 3, 30.0, -20.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1);
EXPLODE_CAR(ClosestCar, true, false);
}
GET_CHAR_COORDINATES(GetPlayerPed(),&dX, &dY, &dZ);
GET_CLOSEST_CHAR(dX,dY,dZ, 30.0F, 1 ,1, &gameped);
if(DOES_CHAR_EXIST(gameped))
{
if(IS_CHAR_IN_ANY_CAR(gameped))
{
GET_CAR_CHAR_IS_USING(gameped, &PlayerVehicle);
APPLY_FORCE_TO_CAR(ClosestCar, 3, 30.0, -20.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1);
EXPLODE_CAR(ClosestCar, true, false);
}
else if(!IS_CHAR_IN_ANY_CAR(gameped))
{
if(!IS_CHAR_ON_FIRE(gameped))
{
START_CHAR_FIRE(gameped);
}
}
}
}
if(ragdoll){
if(IS_BUTTON_PRESSED(0,BUTTON_LB) && IS_BUTTON_JUST_PRESSED(0,BUTTON_B)){
if(!IS_PED_RAGDOLL(pPlayer)){
SWITCH_PED_TO_RAGDOLL(pPlayer,20000,30000,false,false,false,false);
SWITCH_PED_TO_ANIMATED(pPlayer,true);
GIVE_PLAYER_RAGDOLL_CONTROL(GET_PLAYER_ID(),true);
}
else{
SWITCH_PED_TO_ANIMATED(pPlayer,false);
GIVE_PLAYER_RAGDOLL_CONTROL(GET_PLAYER_ID(),false);
}
}
}
//vehicles
Vehicle pveh;
if(vhelper){
if(IS_CHAR_IN_ANY_CAR(pPlayer)){
GET_CAR_CHAR_IS_USING(pPlayer,&pveh);
SET_CAR_CAN_BE_DAMAGED(pveh,false);
SET_CAR_CAN_BE_VISIBLY_DAMAGED(pveh,false);
SET_CAN_BURST_CAR_TYRES(pveh,false);
SET_HELI_BLADES_FULL_SPEED(pveh);
}
}
if(carsonground){
if(IS_CHAR_IN_ANY_CAR(pPlayer)){
GET_CAR_CHAR_IS_USING(pPlayer,&pveh);
SET_CAR_ON_GROUND_PROPERLY(pveh);
}
}
if(bikefly){
if((IS_CHAR_ON_ANY_BIKE(pPlayer)) && IS_BUTTON_PRESSED(0,BUTTON_R)){
float speed;
GET_CAR_CHAR_IS_USING(pPlayer,&pveh);
GET_CAR_SPEED(pveh,&speed);
SET_CAR_FORWARD_SPEED(pveh,(speed * 1.05));
}
}
if(nfs){
if(IS_CHAR_IN_ANY_CAR(pPlayer) && IS_BUTTON_PRESSED(0,BUTTON_R)){
float speed;
GET_CAR_CHAR_IS_USING(pPlayer,&pveh);
if((!IS_CHAR_IN_ANY_BOAT(pPlayer)) && (!IS_CHAR_IN_ANY_HELI(pPlayer))){
SET_CAR_ON_GROUND_PROPERLY(pveh);
GET_CAR_SPEED(pveh,&speed);
SET_CAR_FORWARD_SPEED(pveh,(speed * 1.02));
}
else{
GET_CAR_SPEED(pveh,&speed);
SET_CAR_FORWARD_SPEED(pveh,(speed * 1.02));
}
}
}
//weapons
if(ammo){
if(IS_CHAR_SHOOTING(pPlayer)){
uint weapon,ammo;
GET_CURRENT_CHAR_WEAPON(pPlayer,&weapon);
if(weapon != WEAPON_GRENADE && weapon != WEAPON_MOLOTOV){
GET_MAX_AMMO_IN_CLIP(pPlayer,weapon,&ammo);
SET_AMMO_IN_CLIP(pPlayer,weapon,ammo);
}
}
}
//misc
if(chat_thingy){
int i;
float pos_y = 0.875;
for(i = 16;i >= 0;i--){
if(i < 0) continue;
if(!IS_NETWORK_PLAYER_ACTIVE(i)) continue;
if(!NETWORK_IS_PLAYER_TALKING(i)) continue;
if(NETWORK_IS_PLAYER_MUTED_BY_ME(i)) continue;
GET_PLAYER_RGB_COLOUR(i,&r,&g,&b);
set_up_draw(3,0.3,0.3,r,g,b,255);
draw_text("STRING",0.70,pos_y,GET_PLAYER_NAME(i));
pos_y -= 0.03;
}
}
if(GET_NUMBER_OF_INSTANCES_OF_STREAMED_SCRIPT("player_menuiv") != 0 && show_menu)
menu_shutdown();
//garage
if(in_paint && IS_CHAR_IN_ANY_CAR(pPlayer)){
if(menu[item_select].value != menu[item_select].extra_val){
uint color1,color2,spec1,spec2;
GET_CAR_COLOURS(pveh,&color1,&color2);
GET_EXTRA_CAR_COLOURS(pveh,&spec1,&spec2);
if(item_select == 1)
CHANGE_CAR_COLOUR(pveh,(menu[item_select].value - 1),color2);
if(item_select == 2)
CHANGE_CAR_COLOUR(pveh,color1,(menu[item_select].value - 1));
if(item_select == 3)
SET_EXTRA_CAR_COLOURS(pveh,(menu[item_select].value - 1),spec2);
if(item_select == 4)
SET_EXTRA_CAR_COLOURS(pveh,spec1,(menu[item_select].value - 1));
menu[item_select].extra_val = menu[item_select].value;
}
}
return;
}
答案 0 :(得分:3)
您的void looped_functions(void){
在其他功能中。您可能在looped_functions
之前的函数中某处丢失了},例如
void another_func(void) {
if(something) {
if(somethingelse) {
doit();
// < missing a } here, causing looped_function below to be defined within
//this function
}
}
void looped_functions(void){
}