[RESOLVED] Debug Assertion Failed:vector subscript out of range - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36

Thread: [RESOLVED] Debug Assertion Failed:vector subscript out of range

  1. #16
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Ok

  2. #17
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Name:  Capture.jpg
Views: 18
Size:  11.2 KBName:  Capture 2.jpg
Views: 18
Size:  12.3 KB

    First when I debug, I get the first picture(capture), then after pressing back button a few times I get the second picture(capture 2).

  3. #18
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Whereas, I should be getting a straight road with the background and the tree sprite(I have saved the pictures in the file of my code).

  4. #19
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,450

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    instead using the solution given by 2kaud,
    As I indicated in post #8, the changed code may or not be what you required but would remove the vector failed assertion problem. If the code is not doing what is expected, then the next step is to use the debugger to trace through the code to see where it deviates from that expected.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C, C++ Compiler: Microsoft VS2017.2

  5. #20
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Sorry If that hurt you, please suggest how to use the debugger to trace through the code to see where it deviates from that expected?

  6. #21
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Name:  Capture.jpg
Views: 16
Size:  20.4 KB
    This is what I want.

  7. #22
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,450

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    For info on using the debugger, see https://msdn.microsoft.com/en-us/library/k0k771bt.aspx
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C, C++ Compiler: Microsoft VS2017.2

  8. #23
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Can anyone recommend the correct code and where I have made a mistake?

  9. #24
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,906

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Quote Originally Posted by A_Singh View Post
    Can anyone recommend the correct code and where I have made a mistake?
    Did you try do debug?
    Or you'd like that someone of us debugged it for you?
    Victor Nijegorodov

  10. #25
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    I am sorry but can you debug it for me ?

  11. #26
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,906

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Quote Originally Posted by A_Singh View Post
    I am sorry but can you debug it for me ?
    No, I can't. I don#t have the SFML library on my PC.
    Victor Nijegorodov

  12. #27
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    2 kaud, can you?

  13. #28
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,450

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Quote Originally Posted by A_Singh View Post
    2 kaud, can you?
    No one here is going to debug your code for you. Being able to debug code is an important part of programming. If you haven't used the debugger before now is the time to learn. Once you know from the debugger where in the program it's not doing what is expected, then you know where the error is in the code and or in the design - and be in a position to be either able to fix it or to provide further info as to the nature of the problem.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C, C++ Compiler: Microsoft VS2017.2

  14. #29
    Join Date
    Mar 2017
    Posts
    37

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    Ok, thank you for motivating me. I have read the msdn page you sent me, but I have a question,which step to follow to locate where my code deviates from the original?

  15. #30
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,450

    Re: [RESOLVED] Debug Assertion Failed:vector subscript out of range

    You have designed and written your program. You know how you expect it to work. You step through the code using the debugger checking that what is actually happening via the code is what is expected. When something not-expected occurs then you either have a design problem or a coding issue.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C, C++ Compiler: Microsoft VS2017.2

Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)