CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2012
    Posts
    9

    Unhappy No Error in The Program

    Recently i was working on my project, I came to the last question of my project. i totally understand the question but when i implemented it in Visual Studio 2008 (C++ Express Edition).

    my program was build successfully and there is not even a single error in my program but its not running? i can't see the console and i don't understand the error which i'm having. i tried it on different computers and different VB C++ but all in vain, nothing happening.

    Can you please Run this code in your C++ and tell me whats the problem which i'm having in it!

    I have attached a text file but check it kindly..

    Thanks

    Joanne Sablad..
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2005
    Posts
    315

    Re: No Error in The Program

    Haven't looked at the link but, could it be that the console is opening, the program is running, and the coonsole is closing faster than you can see? Perhaps, open the command prompt and then run the program.

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: No Error in The Program

    This is when you use your debugger to see what your code is actually doing vs what you think it is doing.

  4. #4
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: No Error in The Program

    No offence ment but don't compact your code like that. As GCDEF pointed out the debugger is the absolutely fastest way to find out what's going on but with lines as compact as yours it will be hard to follow the execution (and of course also to read).
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    Jan 2012
    Posts
    9

    Re: No Error in The Program

    Quote Originally Posted by GCDEF View Post
    This is when you use your debugger to see what your code is actually doing vs what you think it is doing.

    Quote Originally Posted by S_M_A View Post
    No offence ment but don't compact your code like that. As GCDEF pointed out the debugger is the absolutely fastest way to find out what's going on but with lines as compact as yours it will be hard to follow the execution (and of course also to read).
    I agree with you but when i run it, it shows me that sorta message, how do i fix it?

    Check the screenshot that i have attached with it.. and tell me the solution !!
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    I agree with you but when i run it, it shows me that sorta message, how do i fix it?

    Check the screenshot that i have attached with it.. and tell me the solution !!
    Why don't you so as the dialog says --

    Hit Retry.

    Then you will see what is causing the issue by looking at the call stack to see which string is bogus.

    Regards,

    Paul McKenzie

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    I agree with you but when i run it, it shows me that sorta message, how do i fix it?

    Check the screenshot that i have attached with it.. and tell me the solution !!
    Also, debugging doesn't just mean starting the debugger and running the program.

    How about single-stepping in your program, set breakpoints, watch variables, etc.?

    Regards,

    Paul McKenzie

  8. #8
    Join Date
    Jan 2012
    Posts
    9

    Re: No Error in The Program

    Quote Originally Posted by Paul McKenzie View Post
    Why don't you so as the dialog says --

    Hit Retry.

    Then you will see what is causing the issue by looking at the call stack to see which string is bogus.

    Regards,

    Paul McKenzie
    I have tried many times but i'm not able to find the mistake!..

    can anyone of you fix that code and send me?

  9. #9
    Join Date
    Apr 1999
    Posts
    27,449

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    I have tried many times but i'm not able to find the mistake!..
    When you hit Retry, what do you see? Where in the call stack is your code that is causing the error?
    can anyone of you fix that code and send me?
    You wrote the code, so you must learn how to fix your own code.

    Learning how to debug is part and parcel of learning how to write a program. Do you think that all of us here write perfectly working programs and never need to debug them? CodeGuru is not a "I write code, you debug it for me while-I-wait" site or forum.

    Regards,

    Paul McKenzie

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    I have tried many times but i'm not able to find the mistake!..

    can anyone of you fix that code and send me?
    You can't post here every time something doesn't work. Learn to use the debugger. It's use is not optional. I've been programming for decades and I still run just about every piece of code I write in the debugger to make sure it's doing what I think it is.

  11. #11
    Join Date
    Jan 2012
    Posts
    9

    Re: No Error in The Program

    Quote Originally Posted by GCDEF View Post
    You can't post here every time something doesn't work. Learn to use the debugger. It's use is not optional. I've been programming for decades and I still run just about every piece of code I write in the debugger to make sure it's doing what I think it is.
    well i'm just new to programming, this is my 2nd month i started learning and i'm in trouble. i'm not a good programmer..

  12. #12
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    well i'm just new to programming, this is my 2nd month i started learning and i'm in trouble. i'm not a good programmer..
    I don't have anything to open .rar files so I can't see your message, but it sounds like if one of the options is to hit Retry, that's what you should do. That will take you to a function when an ASSERT macro has been triggered indicating an unfavorable condition has been met. More than likely you can tell from the code what is wrong.

    From there, open the call stack window and find the last line of code you wrote. Examine the values of the local variables and see what isn't what it's supposed to be.

  13. #13
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    well i'm just new to programming, this is my 2nd month i started learning and i'm in trouble. i'm not a good programmer..
    Then this is an excellent time to learn how to debug. It's a critical skill you will need going forward.

  14. #14
    Join Date
    Apr 1999
    Posts
    27,449

    Re: No Error in The Program

    Quote Originally Posted by joannesablad View Post
    well i'm just new to programming, this is my 2nd month i started learning and i'm in trouble. i'm not a good programmer..
    But the debugger requires very little programming knowledge. As a matter of fact, the debugger will teach you how your program behaves.

    Start your program by hitting F10. Do you see the first line with an arrow pointing to it? That is the first line that will be executed. Now hit F10 again. Do you see the arrow move down? That is the next line that will be executed, etc.

    In other words, you see exactly what steps your program makes in "slow motion", instead of just running it until the end.

    How hard could that be, seriously? Then you learn the other commands that steps into functions, sees the values of variables, set breakpoints etc. Once you determine the line of code that blows up the program, then you dig deeper and see what the values of those variables are (just rerun the program using the debugger) to cause the crash. If you still don't know, then tell us what you observe -- that's the least that's expected from someone posting code they wrote and can't figure out what's wrong.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; January 3rd, 2012 at 01:34 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured