Compilation Errors on Borland C++ 4.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • AmberJain
    Recognized Expert Contributor
    • Jan 2008
    • 922

    Compilation Errors on Borland C++ 4.0

    OK, I downloaded Borland C++ 4.0.
    Now the problem is that when I start the Integrated Development Environment (by double clicking BCW.exe) and type and compile simplest C programs such as------->

    [CODE=C]#include<conio. h>
    #include<stdio. h>
    int main()
    {
    printf("HELLO") ;
    return(0);
    }[/CODE]

    then I get 26 errors such as-------->
    1. declaration syntax error
    2. Variable enum is initialized more than once
    3. Variable void is initialized more than once
    4. Variable _cdecl is initialized more than once
    5. Too many errors or messages

    Above five mentioned error messages are mentioned over and over again and they all constitue 26 errors.

    I know I'm wrong somewhere and I even searched internet for possible source of error, but ended with no success.

    PLUS, What are compiler flags? Do we need to pass them as arguements to command prompt to start BCW to support classic C programming?

    PLEASE HELP...........

    ============
    AmbrNewlearner
    ============
    Last edited by AmberJain; May 27 '08, 03:35 PM. Reason: Forgot something to post
  • oler1s
    Recognized Expert Contributor
    • Aug 2007
    • 671

    #2
    Does the file snippet you show compile if you take out conio.h?

    If you're interested in learning C, please do the following:

    1. Get a modern compiler. BC++ 4 is about 15 years old. Since you can get top quality modern compilers for free, I see no advantage in using old BC++ compilers.
    2. Don't use conio.h as a beginner. It's a non standard header. You start relying on it, other people may not be able to help you when your code fails.
    3. Use whitespace sensibly and as per standard idioms. Even though you only have 7 demonstration lines, there's two instances of not using whitespace as most C programmers would. Separate the include from the name of the file (include <stdio.h> with a space). And maintain proper indentation. It helps us read your code. It helps you read your code. In even slightly larger code files, poor indentation can be an nightmare to work with.

    PLUS, What are compiler flags? Do we need to pass them as arguements to command prompt to start BCW to support classic C programming?
    The compiler has a number of options in how it compiles your code. We refer to these options as compiler flags. With most compilers, you indicate these flags through commandline arguments. I don't know if Borland C++ 4 works like that. Is the compiler separate from the IDE? I'm pretty sure I've used v4 or v3 of BC++ before, but I can't recall if the compiler was separate.

    You shouldn't need to use a flag to indicate C compilation. If your C program is saved in *.c file (with a .c extension) then the compiler should be intelligent enough to default to C compilation.

    Comment

    • AmberJain
      Recognized Expert Contributor
      • Jan 2008
      • 922

      #3
      Originally posted by oler1s
      Does the file snippet you show compile if you take out conio.h?
      No!! still 26 errors.......
      Originally posted by oler1s
      If you're interested in learning C, please do the following:

      1. Get a modern compiler. BC++ 4 is about 15 years old. Since you can get top quality modern compilers for free, I see no advantage in using old BC++ compilers.
      OK I will download the latest Borland C++ compiler. I prefer not to use compilers by other companies, as BORLAND compilers appear to have easier interface to me.
      By the way what are your views about using Borland C++ compiler 5.5. Can you please have a look at link to page below and tell me whether it would be useful and efficient for my needs. If you say YES to it, then I will download it.

      LINK

      Originally posted by oler1s
      2. Don't use conio.h as a beginner. It's a non standard header. You start relying on it, other people may not be able to help you when your code fails.
      OK I will not use conio.h if you say so. But if I want to use clrscr() function in my program, then I will need to include the header file conio.h (as far as I know). Is there any alternative to this?

      Originally posted by oler1s
      3. Use whitespace sensibly and as per standard idioms. Even though you only have 7 demonstration lines, there's two instances of not using whitespace as most C programmers would. Separate the include from the name of the file (include <stdio.h> with a space). And maintain proper indentation. It helps us read your code. It helps you read your code. In even slightly larger code files, poor indentation can be an nightmare to work with.
      Thanks for this valuable advice. I will remember them and implement them in my all future programs.

      Originally posted by oler1s
      The compiler has a number of options in how it compiles your code. We refer to these options as compiler flags. With most compilers, you indicate these flags through commandline arguments. I don't know if Borland C++ 4 works like that. Is the compiler separate from the IDE? I'm pretty sure I've used v4 or v3 of BC++ before, but I can't recall if the compiler was separate.

      You shouldn't need to use a flag to indicate C compilation. If your C program is saved in *.c file (with a .c extension) then the compiler should be intelligent enough to default to C compilation.
      The borland C++ v3.0 and v4.0 compilers [BCC.exe] are separate from IDE [BCW.exe] and I tried today with it's Command Line Arguements. And yes I could successfully compile my C programs from command line. But still I cannot compile my simple C programs from BC++ 4.0 IDE.

      THANKS......... ......
      Waiting for your advice here........

      ============
      AmbrNewlearner
      ============
      Last edited by AmberJain; May 28 '08, 08:55 AM. Reason: MADE a mistake

      Comment

      • oler1s
        Recognized Expert Contributor
        • Aug 2007
        • 671

        #4
        OK I will download the latest Borland C++ compiler. I prefer not to use compilers by other companies, as BORLAND compilers appear to have easier interface to me.
        The 5.5 free release is pure commandline. If you’re OK with that...

        By the way what are your views about using Borland C++ compiler 5.5. Can you please have a look at link to page below and tell me whether it would be useful and efficient for my needs. If you say YES to it, then I will download it.
        I wouldn’t recommend it, because I think there’s better alternatives. But if you’re sticking to C, you should have no problems on it. if you really want to use a Borland compiler for free, 5.5 sounds like your best bet. Go ahead, try it out. It’s free, so you have nothing to lose.

        OK I will not use conio.h if you say so. But if I want to use clrscr() function in my program, then I will need to include the header file conio.h (as far as I know). Is there any alternative to this?
        There are, but all of them carry disadvantages with them. Right now, conio.h and clrscr() is the easiest way.

        I’m telling you to avoid it not because using conio.h is necessarily a bad way. It’s just that you need help from as many people as possible more than you need clearing screen functionality in your code. That’s what I think, anyway. So I’m telling you to avoid conio.h, so more people can help you. Case in point: you start relying on clrscr(), I may not be able to help you. I can’t compile code with with clrscr().

        And yes I could successfully compile my C programs from command line. But still I cannot compile my simple C programs from BC++ 4.0 IDE.
        And I have no idea why. Your code is correct, so it should compile and run fine. It sounds like the IDE needs some configuration changes, but it’s a really old IDE no one here uses, so that’s why getting help for it is hard.

        Comment

        • AmberJain
          Recognized Expert Contributor
          • Jan 2008
          • 922

          #5
          Hello oler1s
          What are your views about DJGPP C/C++ compiler (LINK below). Would it be a better option than Borland C++ 5.5? Or is MSVC++ the best?

          LINK to DJGPP

          I need a compiler in which I can get most of the help from you techies easily as I am a C/C++ newbie and I don't have anyone to guide me.

          BTW, which C/C++ compiler do you presently use personally, oler1s?

          OR please tell me a way to download complete installer for Visual C++ Express 2008. i.e. I mean to say that my windows XP crashes frequently (atleast 2-3 times a week) as I frequently test it for various reasons. And I own a limited Broadband connection. The installer available online is a WEB INSTALLER and I cannot afford to download Visual C++ Express 2008 almost every 15 days (as I'm on limited connection). So if you could tell me a download link to the Visual C++ Express 2008 (complete installer, not a web installer), I will download it. And then (PROBABLY) it would be probably more easier for you techies to help me (while I work on a modern C/C++ compiler).

          THANKS IN ADVANCE........ ...

          ============
          AmbrNewlearner
          ============
          Last edited by AmberJain; Jun 5 '08, 04:51 PM. Reason: forgot to add mentioned link to a URL

          Comment

          • oler1s
            Recognized Expert Contributor
            • Aug 2007
            • 671

            #6
            What are your views about DJGPP C/C++ compiler (LINK below). Would it be a better option than Borland C++ 5.5? Or is MSVC++ the best?
            The DJGPP compiler is even worse for you. It targets DOS, which I am 99% certain you don’t want to do. Unless you are on DOS.

            I have no idea how good BC++ 5.5 is. I assume it’s of decent quality. There’s better options out there, that are also free, so I recommend them instead. It’s up to you to get BC++ 5.5. On Windows, MSVC++ is currently your best option (as I see it). Look, you can get all these compilers for free. I warned you away from BC++ 4 because it is pre-1999 standard C++, and DJGPP because it targets the wrong OS. If you really want BC++ 5.5, it’s free, so get it. Borland has 5.5, Turbo Explorer, and what not for free. I’m sure they’ll work fine for C++.

            BTW, which C/C++ compiler do you presently use personally, oler1s?
            Currently, the only one I have installed is VC++ 2008. When I was working with my Linux server, I used gcc.

            OR please tell me a way to download complete installer for Visual C++ Express 2008... he installer available online is a WEB INSTALLER
            http://www.microsoft.c om/express/download/offline.aspx

            I mean to say that my windows XP crashes frequently (atleast 2-3 times a week) as I frequently test it for various reasons.
            Uh...you use your own OS as a testbed for something that can cripple the entire system? Shouldn’t you be doing this on another computer, or at the very least, under a virtual environment like one that can be setup by Vmware?

            Comment

            • AmberJain
              Recognized Expert Contributor
              • Jan 2008
              • 922

              #7
              First of all, thanks for all help..........

              Originally posted by oler1s
              The DJGPP compiler is even worse for you. It targets DOS, which I am 99% certain you don’t want to do. Unless you are on DOS.
              I have no idea how good BC++ 5.5 is. I assume it’s of decent quality. There’s better options out there, that are also free, so I recommend them instead. It’s up to you to get BC++ 5.5. On Windows, MSVC++ is currently your best option (as I see it). Look, you can get all these compilers for free. I warned you away from BC++ 4 because it is pre-1999 standard C++, and DJGPP because it targets the wrong OS. If you really want BC++ 5.5, it’s free, so get it. Borland has 5.5, Turbo Explorer, and what not for free. I’m sure they’ll work fine for C++.

              Currently, the only one I have installed is VC++ 2008. When I was working with my Linux server, I used gcc.

              http://www.microsoft.c om/express/download/offline.aspx

              No, actually I'm a DOS lover (you might be thinking now that I'm crazy) .I believe that the power and capabilities provided by a Character User Interface (CUI) Operating System (e.g. DOS) is enormous as compared to other Graphical User Interface (GUI) OS (e.g. Windows OSes). I even have FreeDOS installed as a separate OS on my harddisk. And so I'm comforable with DOS.
              But now as you have guided me with a link to offline installer of MSVC++, I will soon download it and switch over to MSVC++ as my preferred C/C++ compiler soon (once it's downloaded).


              Originally posted by oler1s
              Uh...you use your own OS as a testbed for something that can cripple the entire system? Shouldn’t you be doing this on another computer, or at the very least, under a virtual environment like one that can be setup by Vmware?
              OOOPS! I should have provided you with more details about this. I think you misinterpreted me here a bit. Actually, I am pursuing my bachelors degree in computers applications. But, I'm also preparing (side by side) for Ethical Hacker Certification (i.e. Certified Ethical Hacker) and so I frequently use my personal computer (which is the only computer which belong completely to me and only on that PC in this world I own an administrator account for every OS installed on it). I have set up that PC to multiboot with with Windows XP, Red Hat Linux, OpenBSD and FreeDOS. I use this PC of mine to learn Ethical Hacking. I make my PC vulnerable ( to hackers, crackers and to viruses by disabling AntiVirus,) knowing it can harm my PC so that I can learn (a bit) in a real vulnerable environment.
              PLUS, I hope you agree with me that a multiboot PC crashes more frequently and there's more. I know Windows XP and FreeDOS to a great extent but I'm a newbie to RED HAT Linux and OpenBSD and so when I am on these OSes, I frequently make mistakes which damage files of any other OSes. And so my PC crashes.

              BTW, I also believe that a person learns something only by continuosly falling on the ground. So, I know the cause that can crash a PC and so I also learn a lot of PC troubleshooting this way (which I know will certainly help me in CEH exam).


              THANKS AGAIN FOR ALL YOUR HELP........
              I will be back soon (now with C/C++ questions, rather than compiler choice ones) once MSVC++ gets downloaded.

              ============
              AmbrNewlearner
              ============

              Comment

              • AmberJain
                Recognized Expert Contributor
                • Jan 2008
                • 922

                #8
                Hello oler1s,

                Well, I changed my decision. When I visited the site to download msvc++ offline installer, I saw that download was >800MB and so I cannot afford it with my limited broadband connection (only 1 GB Upload/Download per month).

                Is there any site to download installer for only msvc++ 2008 and not for complete Microoft Visual Studio 2008?

                BTW, I have downloaded Bloodshed Dev C++ compiler from link below--->

                LINK

                I think that this even supports Windows Programming and is pretty stable (PLUS latest) C/C++ compiler. So I think you will not have any doubts about it.

                If there are any problems with this tell me, or I should continue C\C++ programming with this one.

                THANKS

                ============
                AmbrNewlearner
                ============

                Comment

                • AmberJain
                  Recognized Expert Contributor
                  • Jan 2008
                  • 922

                  #9
                  Hello oler1s

                  I could also successfully compile and run some of simple C programs in Bloodshed Dev C++ (a few minutes ago).

                  So I can say I'm feeling quite comfortable with it (till now). Hope this comfort lasts till I program in C (i.e. till I live).

                  THANKS

                  ============
                  AmbrNewlearner
                  ============

                  Comment

                  • oler1s
                    Recognized Expert Contributor
                    • Aug 2007
                    • 671

                    #10
                    Is there any site to download installer for only msvc++ 2008 and not for complete Microoft Visual Studio 2008?
                    That’s actually all the express editions combined. The VS 2008 download itself is about 3+ GB.

                    I have downloaded Bloodshed Dev C++ compiler from link below-
                    To be precise, Dev-C++ is an IDE. The compiler it uses is called MinGW, and MinGW is the windows port of gcc.

                    I think that this even supports Windows Programming and is pretty stable (PLUS latest) C/C++ compiler. So I think you will not have any doubts about it.
                    Well, development of the IDE has been abandoned for years now. I don’t know how much MinGW has progressed recently, and what version is packaged with IDE, but it should be aging quite a bit.

                    At this point, I won’t object to your using Dev-C++. I think it’s better than using Borland 5.5, mostly because there’s very widespread beginner use of it. You’ll get a lot of help resources with Dev-C++. The most important thing is you get started with something that works, and Dev-C++ will do for a while. Plus, if you do development on linux or freedos, you’ll be using a gcc compiler anyway, so you might as well get familiar with it on Windows.

                    Comment

                    • AmberJain
                      Recognized Expert Contributor
                      • Jan 2008
                      • 922

                      #11
                      Originally posted by oler1s
                      That’s actually all the express editions combined. The VS 2008 download itself is about 3+ GB.

                      To be precise, Dev-C++ is an IDE. The compiler it uses is called MinGW, and MinGW is the windows port of gcc.

                      Well, development of the IDE has been abandoned for years now. I don’t know how much MinGW has progressed recently, and what version is packaged with IDE, but it should be aging quite a bit.

                      At this point, I won’t object to your using Dev-C++. I think it’s better than using Borland 5.5, mostly because there’s very widespread beginner use of it. You’ll get a lot of help resources with Dev-C++. The most important thing is you get started with something that works, and Dev-C++ will do for a while. Plus, if you do development on linux or freedos, you’ll be using a gcc compiler anyway, so you might as well get familiar with it on Windows.
                      THANKS,

                      I will now continue programming with Bloodshed dev c++ IDE and MinGW compiler.

                      ============
                      AmbrNewlearner
                      ============

                      Comment

                      • AmberJain
                        Recognized Expert Contributor
                        • Jan 2008
                        • 922

                        #12
                        Originally posted by oler1s
                        Plus, if you do development on linux or freedos, you’ll be using a gcc compiler anyway, so you might as well get familiar with it on Windows.
                        Well, I tried the "gcc" command line compiler (available with Bloodshed Dev C++) on freedos and command prompt shows a error message- "This program cannot be run in DOS mode" i.e. my version of gcc is not supported on 16 bit FreeDOS.
                        So, I'm searching for a version of gcc which runs smoothly on FreeDOS.

                        THANKS.......

                        ============
                        AmbrNewlearner
                        ============

                        Comment

                        • oler1s
                          Recognized Expert Contributor
                          • Aug 2007
                          • 671

                          #13
                          y version of gcc is not supported on 16 bit FreeDOS.
                          So, I'm searching for a version of gcc which runs smoothly on FreeDOS.
                          Then I presume that would be DJGPP.

                          That said, you may want to work with C++ in a more normal environment (32 bit Windows) before you explore programming in older, and more restricted environments.

                          Comment

                          • AmberJain
                            Recognized Expert Contributor
                            • Jan 2008
                            • 922

                            #14
                            Originally posted by oler1s
                            Then I presume that would be DJGPP.

                            That said, you may want to work with C++ in a more normal environment (32 bit Windows) before you explore programming in older, and more restricted environments.
                            Oh, yes I think you are right. I must work "with C++ in a more normal environment (32 bit Windows) before I explore programming in older, and more restricted environments".

                            THANKS......... ..

                            ============
                            AmbrNewlearner
                            ============

                            Comment

                            • JosAH
                              Recognized Expert MVP
                              • Mar 2007
                              • 11453

                              #15
                              Originally posted by ambrnewlearner
                              Oh, yes I think you are right. I must work "with C++ in a more normal environment (32 bit Windows) before I explore programming in older, and more restricted environments".
                              Why do you want to go over the edge w.r.t. main stream desktop operating
                              systems while at the same time you're still studying the languages and
                              applications? Use MS Windows or linux but for the time being, stay away from
                              alien platforms for your own sake; you can do that later if you feel like it.

                              kind regards,

                              Jos

                              Comment

                              Working...