Thread: syntaxerror but compiled with success

  1. #1
    Registered User runekeeper's Avatar
    Join Date
    Nov 2005
    Posts
    5

    syntaxerror but compiled with success

    Hello, i am starting to learn C by myself and i nearly know nothing.
    I am using the Borland Compiler 5.5 for C++ because i couldnt find a real C compiler and i use windows XP. I am learning by the nice tutorial from this website and i have made a few silly programs by myself. But i cant finish a program with an if condition and also for doesnt real work. Even if i copy the Sourcecode from the website ist doesnt work.

    I can compile the programs with no error and it seems to be everything ok. But when i try to start the program i get always the message:

    syntaxfehler (syntaxerror)....

    Does anyone know about this problem i couldnt find it in the FAQ or on other places in the forum. Much thanks in advance for your help.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Could you post the code?
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User runekeeper's Avatar
    Join Date
    Nov 2005
    Posts
    5
    i have copied the code from the tutorial here.

    Code:
    #include <stdio.h>	
    
    int main()                            /* Most important part of the program!
    */
    {
        int age;                          /* Need a variable... */
      
        printf( "Please enter your age" );  /* Asks for age */
        scanf( "%d", &age );                 /* The input is put in age */
        if ( age < 100 ) {                  /* If the age is less than 100 */
         printf ("You are pretty young!\n" ); /* Just to show you it works... */
      }
      else if ( age == 100 ) {            /* I use else just to show an example */ 
         printf( "You are old\n" );       
      }
      else {
        printf( "You are really old\n" );     /* Executed if no other statement is
        */
      }
      return 0;
    }

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    ::shrug::
    c:\progra~1\borland\bcc55\bin\bcc32 -P- -c @MAKE0000.@@@
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    test.c:
    c:\progra~1\borland\bcc55\bin\Ilink32 @MAKE0002.@@@
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
    I don't see any issues there.

    [edit]???
    Last edited by Dave_Sinkula; 11-09-2005 at 10:57 PM.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    Registered User runekeeper's Avatar
    Join Date
    Nov 2005
    Posts
    5
    Yes, thats what also is ok at my computer. I get the error message if i try to start the program.
    I hope i didnt misunderstand you because english isnt my mother language...

    Do i also need the Ilink32 program ? I only compilate by using bcc32 without any additional options in the commandline.

    Thanks much for your patience with me...

  6. #6
    Registered User runekeeper's Avatar
    Join Date
    Nov 2005
    Posts
    5
    This is what i get when i do it...

    G:\Programmieren\Programme\If Else>bcc32 if.c
    Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
    if.c:
    Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland

    G:\Programmieren\Programme\If Else>if
    Syntaxfehler.

  7. #7
    Super Moderator Harbinger's Avatar
    Join Date
    Nov 2004
    Posts
    74
    'if' is also the name of a command internal to the command interpreter.

    Try calling your program something else, or try typing
    if.exe
    or maybe
    .\if
    or
    .\if.exe

  8. #8
    Registered User runekeeper's Avatar
    Join Date
    Nov 2005
    Posts
    5
    Thanks very much....
    I never would have found out that

    But thanks to you i can continue learning, actually i am short of time already. I shall program machines with C during my internship and it will begin on the first december.

    Again much thanks for your help....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get RSSI value, send to sensor, sensor receive package, repackage it?
    By techissue2008 in forum Networking/Device Communication
    Replies: 1
    Last Post: 03-04-2009, 10:13 AM
  2. Replies: 1
    Last Post: 03-12-2008, 12:10 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 10:45 AM
  5. Operator overloading in template classes
    By moejams in forum C++ Programming
    Replies: 5
    Last Post: 07-21-2003, 05:16 PM