Thread: conflicting compilers

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    conflicting compilers

    ok, here is the deal, I have to do a couple of programs for my C++ class and I will be using devc++, now I have this educational version of borland which works similar to what they have at school, but I still have the problem of the program ending early. At school I don't have the problem, I made a program, and it ran fine, didnt' close early or anything, but when i had the exact same program ran on my comp, it ends early. I have no Idea why it did this, is there some setting I have to put. Also, at school, it executes a program with a white screen instead of a black one. I just don't want to hand in a program that won't compile and get an F on my first assignment.

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    You have to pause the system. They are many ways to do it. For example, you can use cin.get() or system("PAUSE"). The system pause only works on windows/dos systems. BTW, other people might tell you to use kbhit or other functions in conio.h. Try to stay away from these though b/c they are non-standard functions and everyone might not have them.

    P.S. The system function is located in <cstdlib> or <stdlib.h>

    P.S.S Try searching the board before you ask questions next time because this question has been asked many times before. It is also in the FAQ at this site.

  3. #3
    Registered User
    Join Date
    Apr 2002
    Posts
    362
    golfinguy4 is on the money here.

    The white screen/black screen issue is an implementation default which, in regular people terms, means that it depends on which compiler you're using.

    Now, I wish you were using Borland at school and devc++ at home. Borland is, in my experience, more accepting of code compiled on other compilers, i.e. MSVC++ code compiles quite readily on Borland, but not necessarily the other way around. However...

    If your instructor knows what he/she is doing, he/she will have a laptop with both compilers installed allowing the student to write his/her code into either. (Tell your instructor that golfinguy4 said so. )

    I know, I'm making light of this and you're feeling panicked. Never panic. You'll do fine!

    -Skipper
    "When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow

  4. #4
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    I have a better idea, why not open up a dos window and run your executable from where it is supposed to run?
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  5. #5
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    hmm, I put in the system pause function and tried to compile it with the version I have and it didn't fully compile it. I think the version I have is a bit old, it's version 5.02. I am afraid that if I hand it into the teachere and it doesn't compile I will get my first low grade. I used the "system("pause"); function along with the header file iostream.h. Now I know that in the verison we have at school, it will get an error with .h after the header, but I don't know if the pause function will work. To be safe, should I just put something such as
    Code:
    int x;
    cin >> x;
    to keep the prog from closing. Sorry if this has been asked but I didn't have much luck when I searched.

  6. #6
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Include <cstdlib> ( or <stdlib.h> if using the old header files)when using system().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 08-23-2008, 01:16 PM
  2. C++ Builder Comparison
    By ryanlcs in forum Tech Board
    Replies: 14
    Last Post: 08-20-2006, 09:56 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Compilers for Windows
    By LegendsEnd in forum Windows Programming
    Replies: 2
    Last Post: 03-26-2004, 08:03 AM
  5. Compilers, Compilers, Compilers
    By Stan100 in forum C++ Programming
    Replies: 11
    Last Post: 11-08-2002, 04:21 PM