Thread: VS2010C++ error with assert when running exe

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    55

    Arrow VS2010C++ error with assert when running exe

    Hi all, I wrote my program using DEV C++ and took the advice of many people to make the switch to visual c++. I've remade all my cpp and header files and it all compiles fine, but when i go to run the executable i get the following error:

    http://img703.imageshack.us/img703/8...eenshot1sy.png

    and heres the code to which it refers:

    http://img200.imageshack.us/img200/6...enshot2azv.png

    thank you for your help

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    214
    Sorry I don't have a microscope so I can't read the code.

    Have you tried setting break points and debugging the code?

  3. #3

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    You created the asserts to check the validity of the input file. Your asserts failed. You're unable to deduce the cause of the failure of your own assertions?

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Or even if they're not your assertions, but automatically added, you still get a line number. Line 133 as I recall; I'll bet you're trying to open a file, for which you did not specify a path; and the file does not exist in the current working directory of your program. (EDIT: If I had realized someone would be so silly as to post a screenshot of their code, then I would have looked at both screenshots. Mea culpa.)
    Last edited by tabstop; 08-01-2011 at 09:27 AM.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    55
    Quote Originally Posted by rags_to_riches View Post
    You created the asserts to check the validity of the input file. Your asserts failed. You're unable to deduce the cause of the failure of your own assertions?
    that one cpp and header i took from an online source, so i suppose it seems the pathing for my images is wrong, if my image files are in the same place as my source code files do i need to do anything more than "image.bmp" ? ie. no /'s ?

    thanks

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If your path is just "image.bmp" with no /, then your file needs to be in the current directory of your .exe, which I believe is almost never the same directory that your source code is in. You can use this to tell you where the current directory is, or you can use SetCurrentDirectory to set the cwd, or you can just include the whole path.

  8. #8
    Registered User
    Join Date
    Oct 2006
    Posts
    55
    perfect! thankyou, i didnt know the images were supposed to be in the same directory as the .exe, i'm used to using dev c++.

    thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linker error on assert()
    By sbayeta in forum Windows Programming
    Replies: 1
    Last Post: 08-21-2005, 11:47 AM
  2. Assert error when using CFileDialog Constructor
    By torbjorn in forum Windows Programming
    Replies: 3
    Last Post: 11-04-2003, 03:38 AM
  3. Assert Debug Error??
    By xddxogm3 in forum C++ Programming
    Replies: 5
    Last Post: 10-20-2003, 08:21 PM
  4. error running application
    By somesh in forum Tech Board
    Replies: 4
    Last Post: 06-25-2003, 09:50 PM
  5. Error while running
    By Fallen in forum C++ Programming
    Replies: 5
    Last Post: 06-24-2002, 05:51 PM