Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

cpp works but exe not :-(

Posted on 2000-03-23
14
Medium Priority
?
306 Views
Last Modified: 2010-04-02
Hi,

I run a cpp file in the Borland C++5.02 edit window, it looks fine.
Immediately after that I run the created exe file and got error message:
"This program has performed an illegal operation and will be shut down."

This is my old problem...just don't know what to do.

Do you think I should send the code to you for check? Or any suggestion?    
0
Comment
Question by:victorlong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 5

Expert Comment

by:pitonyak
ID: 2651510

1) Post the code

2) Check for uninitialized variables. I recently had this problem and it was random based upon what just happened to be in memory when it was created. In the debugger the RAM just happened to be set to zero.

3) Use a binary search and start commenting out code until you have a small program which fails.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2651770
Run the program under a debugger and see where it is crashing.

Most likely you are usng an invalid pointer.
0
 

Author Comment

by:victorlong
ID: 2652957
To pitonyak :

Thank you.

Yes, The program have been reduced but still too big to be posted.......

--------------------------------------------------------

To nietod :

Thank you.

I need to find a debugger? Where?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:amador
ID: 2653017
you can use Visual C++ to debug, is the better.

Do you have it?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2653056
Yes, VC's debugger is far far beter than Borland's.  But since victorlong is using using Borland 5, he probably doesn't have VC....

Borland 5 comes with a debugger.  There should be a menu option to run the program under the debugger.  (Its been 4 years since I've seen Borland 5 so I don't know what it is called.)

However, you should strongly consider buying an up-to-date compiler.  BC 5 is very very very out-of-date.  I would recommmend VC 6 or Borland Builder 5. (VC usually over builder).  Both will have far superior debugggers and numerious other improvements too.
0
 

Author Comment

by:victorlong
ID: 2653190
To pitonyak :

Thank you.

Yes, The program have been reduced but still too big to be posted.......

--------------------------------------------------------

To nietod :

Thank you.

I need to find a debugger? Where?
0
 

Author Comment

by:victorlong
ID: 2653266
To amador:

No, I haven't got  VC :-)

To nietod:

Do I need one month to lean VC?

I did further test, the error seems not stay at one place! I commented out paragragh A, the error dissapeared when run the exe. Next time I restore paragragh A but commented out paragragh B, the error can also dissapeared.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2653274
The debugger is part of BC 5.   You already have it.   Look under the menus.
0
 

Author Comment

by:victorlong
ID: 2653522
To nietod :

Yes, I know that one and think that is difficult for me to use.....I hope we can set some feature to a compiler so that the errors may be chatched and display messages domething like "divide by zero", "out of bound" or "invalid pointer"....
0
 
LVL 22

Expert Comment

by:nietod
ID: 2653543
It is not hard to learn VC and well worth it.  it has fantastic on-line help, which is the main reason I usually recommend it over BC and BCB.   There are also several good books available for learning VC itself.

The behavior you describe is common when you are using uniitialized pointers.  As you add/remove stuff in each version the damage done by the pointer moves around and causes different problems.
0
 
LVL 22

Expert Comment

by:nietod
ID: 2653556
There is no option to print messages like that.  You must use a debugger.  One comes with BC!  There will be a debug option in the menus.  
0
 
LVL 2

Accepted Solution

by:
abesoft earned 280 total points
ID: 2653708
Borland's debugger (Turbo Debugger) is called TD (DOS version), TD386 (extended DOS version, I think), or TDW (Windows version).  All are .exe's.  So, if your app is a Windows app, you could use Window's "File Find" command to look for TDW.EXE, and then run that.  

From the debugger, you can load up your app and run it.

Good luck.
0
 

Author Comment

by:victorlong
ID: 2654867
Hi abesoft,

Your information is great:

1. when try the TDs I found Borland c++5.02 is only a dos version!!
2. I catch the bug in my program: divide by zero again!!!

That bug stop running the exe but not the cpp.

I need to test further....
0
 

Author Comment

by:victorlong
ID: 2655373
To  nietod:

Thank you so much for your help. Perhaps, I will try to learn VC one day :-)

I will give the points to abesoft who's suggestion directly leads the solusion of the question.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question