Thread: cant figure out error

  1. #1
    Registered User
    Join Date
    Jul 2010

    cant figure out error

    int main(int nNumberofArgs, char* pszArgs[]); void mainmenu (int*); { int i; if(strlen(key)!=10)

    error: expected unqualified-id before ' { ' token

    can anyone help me figure this out. its the only error in code. thanks

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Egad's man! How are you supposed to let the compiler tell you which line the errors are on, if all the errors are on the same line!?

    Typically main starts and ends with curly braces {}, like so:

    int main()
         /* function calls and other code here */
       return 0;
    Your function prototypes should either be included with a header file, or in the same file before main, or you can just have the functions themselves before main. Functions are like main in terms of how they use brackets and curly braces:

    int some_func(int var1, int var2)
          return var1 + var2;

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    At the very least there's a semi-colon that doesn't belong.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 10:52 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM