Home Forums C Programming Linker Errors, i do believe i need help

Viewing 5 reply threads
  • Author
    Posts
    • #2181
      AnnelieSchoenhe
      Participant

      Okay, I’m studying C in order to code homebrew for the PSP kernal 3.XX and higher. (No Kxploit). Thing is, i’m starting out creating regular computer programs first. But wait, the tutorial i’m using doesn’t explain errors. So here I am, staring at two linker errors regarding functions. I’ve seperated the functions from the main function so i can work on them seperately in differn’t source files. I’m a new person to this coding business, so if you need my code or such, i’ll gladly post up here. Its nothing no one can do. ^_^

    • #3524
      GWILouisaxwzkla
      Participant

      Would help to post your code and errors. Make sure that the file your including has the correct “include” syntax , like:

      and make sure that your function prototypes and declarations match perfectly or the linker will not associate the two correctly….

    • #3525
      AnnelieSchoenhe
      Participant

      Before i start, i fortunetly was able to fix the Linker errors. I fear i may have more of them later, but when that time comes, i’ll fix them. Now i have new errors.

      Thats the code, now here are the current errors:


      In function ‘addition’:
      Line 49 :’count’ undeclared (first use in this function
      (Each undeclated identifier is reported only once
      for each function it appears in.)
      In function ‘counting’:
      Line 82: syntax error before “else”
      Line 84: ‘exit’ undeclared(first use in this function)
      At top level:
      Line 86: syntax error before ‘}’ token
      In function ‘main’:
      Line 119: syntax error before “else”


      Those are the errors. I don’t understand why the pop up. I fix one, and another two take that one’s place. What in the world is going on?

    • #3526
      JonathaThurston
      Participant

      When your using an if/else statement you can’t give a condition to the else instead you should use else if(condition).

      Also your calling int count at the start of the function and again at the start of your do/while loop.

    • #3527
      AnnelieSchoenhe
      Participant

      Wait, so the first else after the initial if should be if followed by a else Which is the second else in the statement right?

      And even after that, i still recive errors up the ass. I built this code form the floor. How did these codes slip past?

    • #3528
      JonathaThurston
      Participant

      Here read http://www.cprogramming.com/tutorial/c/lesson2.html for information on if/else statments, and your if should be

      as what you did assigns 3 to exit.

Viewing 5 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.