Frustrating error.

Discussion in 'Mac Programming' started by Quboid, Nov 6, 2006.

  1. Quboid macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #1
    :mad:

    Hey guys. I've been writing small C scripts for a short while now and it has been well up to today. i keep getting a strange error message when i have already fixed all the syntax mistakes. The strange thing is codes that i have already compiled and tried are now giving me the same message refuse to execute. The message is as follows:

    "command/usr/bin/gcc-4.0 failed with exit code 1".

    Anybody have any idea what this is? thanks, help would be appreciated.
     
  2. Sean7512 macrumors 6502a

    Joined:
    Jun 8, 2005
    #2
    Can you give us the line of code that the error is for? Actually, a few lines above and below the line in question can help a lot in having us helping you.
     
  3. Quboid thread starter macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #3
    thats the main problem i have. Its not giving me the line of code that the errror is for. All the syntaxes are perfect. It must fails to execute and give me that error. this is a program that functioned flawlessly until today:

    #include<stdio.h>
    #include<math.h>
    int a, b, d, e, f, op , sqt;
    char c;

    int main (void) /* basic mathermatical operacions*/
    {
    printf("enter a number");/*menu and asking for necessary data*/
    scanf("%i",&a);
    printf("enter another number");
    scanf("%i",&b);
    printf("this is the menu");
    printf("\n 1. *");
    printf("\n 2. +");
    printf("\n 3. -");
    printf("\n 4. /");
    printf("\n 5. mod");
    printf("\n 6. ^");
    printf("\n 7. square root");
    printf("\n choose an operation");
    //fflush(stdin);
    //c=getchar();
    scanf("%d",&op); /* effectuado las operaciones*/
    if(op==1){
    d=a*b;
    }
    if(op==2){
    d=a+b;
    }
    if(op==3){
    d=a-b;
    }
    if(op==4){
    d=a/b;
    }
    if(a>b||a==b)
    {
    if(op==5){ /* finding the mod* special function for mod*/
    e=a/b;
    printf("%d, is the the quotient and",e);
    d=a-b*e;
    }
    }
    if(a<b&&op==5)
    {
    printf("\n the first number is smaller than the second, the mod cannot be defined as a whole number");
    }

    if(op==6){ /*raises the first number to the power of the second*/
    d=pow(a,b);
    }
    if(op==7){ /* square root operacion, special funcion inside, asks for data on which number to square root*/
    do{
    printf("\n for the square root of the first number enter 1 for the square root of the second number enter 2");
    scanf("%d",&sqt);
    if(sqt==1){
    d=pow(a,0.5);
    }
    if(sqt==2){
    d=pow(b,0.5);
    }
    }while(sqt!=2&&sqt!=1); /* validation ensuring user types 1 or 2 */
    }
    if(op<1||op>7){
    printf("\n error no seas buey");
    }
    else{
    printf(" \nthe result of your operation is: %d",d);
    }
    return 0;
    }
    I know its much, but its the only reference i have. It was working fine until today and i just dont get it. Thee error i mentioned just appears as an error, it doesnot point me to a line (i.e syntax error).
     
  4. Sean7512 macrumors 6502a

    Joined:
    Jun 8, 2005
    #4
    I am relatively new to programming myself, but I have to ask why do you have "int main (void)"? I have never wrote void in my programs, I've only done "int main ()" That would be my only suggestion. I am not sure on some of the other code, such as "printf" or "scanf" because I've always used cout and cin, so I am not entirely sure about those syntaxes. They do look to be alright though....

    Sorry, I'm not much help, I tried :eek:

    EDIT:
    Not sure about this, but in your code
    "}while(sqt!=2&&sqt!=1); /* validation ensuring user types 1 or 2 */"
    does the do-while end with a semi-colon? I want to say that in either a while loop or a do-while loop, a semicolon is not used. I am not sure, that is the only other thing I can think of. After coding in assembly, it was actually harder than it should have been to read through that code, haha.
     
  5. Quboid thread starter macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #5
    Thanks anyways. I am trying to figure out what i did to my computer recenly, and all i could remember doing yesterday was put enable "devmode" from terminal, i used a command that i got of this site yesterday, the command was surpose to allow me to move dashboard item to teh Desktop (it actually works but is not as cool , since the dashboard item is "always untop"), could it be related to me putting that command in terminal yesterday?
     
  6. rtharper macrumors regular

    rtharper

    Joined:
    Sep 6, 2006
    Location:
    Oxford, UK
    #6
    It's definitely a problem with your environment, I just compiled and executed the code without a problem.
     
  7. mrichmon macrumors 6502a

    Joined:
    Jun 17, 2003
    #7
    What command are you trying to use to compile the c program. Please post the exact command line.

    BTW: As a terminology point, the code you posted is not a "C script". It is a program written in the C programming language. All C code is compiled into a binary file that is executed. The word "script" is commonly used to refer to interpreted instructions such as in Applescript or the Bourne shell.
     
  8. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
  9. Quboid thread starter macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #9
    Someone asked what command i am using to compile the program. in x ccode, when i hit build the program doesn't even execute and gives me this lame error. I am way far from compitent in the use of Xcode or anyy compiler for that matter, my skills in programming are purely due to logics, but i cant figure out this error at all. It makes no sence to me:

    command/usr/bin/gcc-4.0 failed with exit code 1

    whenever i try to build the (any) code, i get this message.
    Someone said they think the GCC is broken, i wouldn't surpose reintalling Xcode would help?

    Any suggestion, anybody had a similar problem?
     
  10. Quboid thread starter macrumors 6502

    Joined:
    Oct 16, 2006
    Location:
    everywhere
    #10
    I just tried building that code again and that's the entire error message:


    powerpc-apple-darwin8-gcc-4.0.0: no input files
    powerpc-apple-darwin8-gcc-4.0.0: no input files
    powerpc-apple-darwin8-gcc-4.0.0: no input files
    powerpc-apple-darwin8-gcc-4.0.0: no input files


    rtharper mentioned the program compiled fine for him, so what am i missing?
     
  11. zimv20 macrumors 601

    zimv20

    Joined:
    Jul 18, 2002
    Location:
    toronto
    #11
    if it were me, i'd start debugging my environment. make a new project, write a hello world program, and see if i could get that to run.
     
  12. roberthuttinger macrumors newbie

    Joined:
    Sep 24, 2008
    #12
    I just got the same error!

    but in the iPhone SDK. but heres the weird part. I had just added an array function, compiled, all good, but oops i forgot to add an NSInteger. So I added it and poof blamm whammo I get the error. I remove the NSInteger, and now its fine. Im rebooting (again) so hopefully its a temporary binding issue?

    cheers.bo

    tCiMP :apple: Wyzfam :apple: tMiMP :apple: My Baby Signs
     
  13. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #13
    this thread is 2 years old, and tangentially related to your problem. Start a new thread, and include the code that is failing.

    -Lee
     

Share This Page