Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Strange C++ behaviour - Urgent help needed

Options
  • 03-04-2004 3:37pm
    #1
    Registered Users Posts: 4,613 ✭✭✭


    I have just started a computer course with Open University and the first assignment is now due. I have to write and amend sections of C++ code and test using Borland C++ Bulider. Trouble is when I try to run anything in (or outside of) Builder nothing happens.

    It compiles and links no problem but when the .exe is run, the Dos window (what is it's proper name?) opens with a flashing cursor, no text is displayed. The code is just simple display question, process answer stuff. My tutor has tried it on his PC and it works fine. On mine I get an empty window and CPU usage goes up to 100%. This happens on both my desktop and my laptop.

    My OS is WinXP pro w/SP1. Borland builder was provided by the OU and is version 5. OU helpdesk got me to send them the code and a screenshot of task manager but have not got back to me with anything yet. I could scrape by on this assignment, now that the tutor has tested the code, by best guessing some of the smaller stuff but obviously would be doing a computer course without a computer if this continues.

    Any advice or suggestions would be hugely appreciated.


Comments

  • Registered Users Posts: 491 ✭✭Silent Bob


    post code


  • Closed Accounts Posts: 1,135 ✭✭✭KlodaX


    cursor? .. did you try typing something at it? .. did it print or accept any values?


  • Registered Users Posts: 1,372 ✭✭✭silverside


    yes, post code.

    failing that

    install dev-c++ (free-use google) and build your code in that (should take < 10 mins to do all that).

    Possibly reinstall C++ builder.


  • Closed Accounts Posts: 5,564 ✭✭✭Typedef


    try adding.

    system("pause"); to the bottom of your code or

    open a command prompt, cd directly to the directory with the executable you created and maybe trying running it from the command prompt, instead of from within the IDE.


  • Registered Users Posts: 4,613 ✭✭✭milltown


    Code attached.

    It has been tested by my tutor and it works on his PC. Builder, libraries and templates have been reinstalled and it behaves the same on both my computers, laptop and desktop (both running WinXP btw).

    Oh and as regards the cursor, just like a flashing underscore and won't accept any input.


  • Advertisement
  • Registered Users Posts: 1,372 ✭✭✭silverside


    I can't download that attachment. My PC tells me it's corrupted.

    Have you tried installing dev-c++? Its free and easy to use and would narrow down the problem to either your code or the compiler.


  • Registered Users Posts: 5 barryg


    I don't see anything wrong with your code and since your tutor can execute it this would probably eliminate the code as the problem. I did the same course 3 years ago.

    It could be the way you configured borland builder or windows. Did you follow the instructions OU. You could always uninstall and reinstall it.

    Here's a few things to try just to see what is working.

    Go to Run in the start menu and type cmd. A dos console should open and display a prompt. Check this to make sure your console works. Type dir in it. It should display the contents of the directory.

    Cut the code down to one or two lines. Just a prompt and a question. Simplify things.

    Insert a breakpoint in the code you displayed to this thread. To do this left mouse click in the margin top the left of your code in builder. Pick the first WriteStringCr line for example. When you execute the code processing will stop at that line and you can use the F8 key to step through each line. Come to think of it maybe you have a breakpoint already and it won't execute beyond that line.

    Modify and rebuild the code.


  • Registered Users Posts: 4,613 ✭✭✭milltown


    Thanks for the tips, keep em coming.

    C++ Builder was installed and configured as instructed by the OU. Has been uninstalled and reinstalled since on both computers.

    I have tried stripping it right down to just a writestring statement and still it uses 100% CPU and displays nothing.

    I use the command line fairly regularly and have just checked it again, no problem there.

    So I'm left with:

    Code is proven to work so it's not the problem.
    Command.exe works, not the problem.
    Same behaviour on two different PCs with two different XP installations, unlikely to be the problem.

    Most likely culprit seems to be Builder, yes? I can run the .exe that builder created without opening Builder, with the same result. Does that mean it's likely to be a compiling or linking problem then?

    I'm going to try Dev C++ now. I may be back with some lame questions about where I need to put libraries and headers and whatnot.

    Thanks again.


  • Registered Users Posts: 5 barryg


    Could it be a syntax error in one of these lines?

    #pragma hdrstop
    #pragma argsused

    Try a sample code from the OU disk.


  • Registered Users Posts: 4,613 ✭✭✭milltown


    Those lines are provided in the skeleton program with which I am to answer the question. I have decided that there is no way I can complete the course this year. I am already behind with the first TMA and still haven't got the software working. I read a piece on the OU website which seemed to suggest that C++ Builder isn't strictly compatible with XP. I'm going to defer until next year when they will, hopefully, have realised that the majority of people are now using XP.

    Thanks a million for all the help guys! It says a lot that I got better and faster support here than I got from the OU helpdesk. Go Boards!


  • Advertisement
  • Registered Users Posts: 5,335 ✭✭✭Cake Fiend


    Surely they don't require you to use the Borland compiler for the course - I presume it's only a suggestion?

    DevC++ is a pretty nice IDE, I use it myself in my sporadic bouts of coding. Did you try it? Did it work?


  • Registered Users Posts: 6,306 ✭✭✭OfflerCrocGod


    Are you dynamic linking?; use static. Also dump Borland 5 - it's total rubbish it doesn't even support ANSI C99 (if memory serves right). Also ask your tut for his PATH variable in WinXP and compare it to yours if he has any extra directories add them to your PATH. Use Dev C++; oh and use Dev C++ (in case you haven't figured it out yet:D).


Advertisement