Thread: my Visual Studio Ultimate 2013 is messed up

  1. #1
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61

    my Visual Studio Ultimate 2013 is messed up

    I think I changed some configurations on my Visual Studio Ultimate 2013 now I get this error message everytime I compile something

    my Visual Studio Ultimate 2013 is messed up-untitled-jpg

  2. #2
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    my Visual Studio Ultimate 2013 is messed up-untitled-jpg

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    There is nothing wrong with Visual Studio. This is what it looks like when your code crashes. You have a bug somewhere.

    If you bother to look in the window, you'll see it's pointing to the call to scanf_s(). Probably a buffer overflow.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  4. #4
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    Quote Originally Posted by brewbuck View Post
    There is nothing wrong with Visual Studio. This is what it looks like when your code crashes. You have a bug somewhere.

    If you bother to look in the window, you'll see it's pointing to the call to scanf_s(). Probably a buffer overflow.
    The code compiled about 6 times before I messed with the VS

  5. #5
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by fouzimedfouni View Post
    The code compiled about 6 times before I messed with the VS
    Just because your code compiles, does not mean it has no bugs.

    The screenshot you posted clearly shows an application crash, with the debugger stopped at a specific line of code. If you don't understand what you are looking at, we can help explain it to you. But if you don't believe me, I'm not sure how I can help.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  6. #6
    Registered User
    Join Date
    Mar 2010
    Posts
    583
    I agree with brewbuck -- I can only just make out the error -- but I can certainly spot the words "memory violation"! The problem with memory corruption is that it bites at unexpected times. Just be glad your debugger yelled at you -- it's a lot hard to track these things down in the wild.

    I think (sorry, I'm on Linux today) that there is an "exceptions" dialog box you can get at in VS (think it's under the debug menu). My memory is a little hazy but I seem to remember that if you turn off exception catching then it's a lot easier to see what's gone wrong.

    But in the interests of being fair -- what exactly do you think you did to screw up your debugger? If you've been messing with the property settings, it may be worth starting a new project and copying your source over..... but I'd bet that the same thing would happen again.

  7. #7
    Registered User
    Join Date
    Sep 2014
    Posts
    364
    Your problem is that you use scanf_s like scanf, but scanf_s needs additional parameter.
    If you use special functions from Microsoft you should know this.

    Look: https://msdn.microsoft.com/en-us/library/w40768et.aspx

    Quote Originally Posted by Microsoft
    Unlike scanf and wscanf, scanf_s and wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or string control sets that are enclosed in []. The buffer size in characters is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if you are reading a string, the buffer size for that string is passed as follows:

    char s[10];

    scanf_s("%9s", s, _countof(s)); // buffer size is 10, width specification is 9

    The buffer size includes the terminating null. You can use a width specification field to ensure that the token that's read in will fit into the buffer. If no width specification field is used, and the token read in is too big to fit in the buffer, nothing is written to that buffer.
    Other have classes, we are class

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by smokeyangel View Post
    I think (sorry, I'm on Linux today) that there is an "exceptions" dialog box you can get at in VS (think it's under the debug menu). My memory is a little hazy but I seem to remember that if you turn off exception catching then it's a lot easier to see what's gone wrong.
    I only have VS2010 in front of me here, it may have moved slightly in 2013. Go to the Debug menu and choose "Exceptions..." A dialog will appear showing a tree view. Open the entry labeled "Win32 Exceptions." There will be a bunch of different codes listed. The easiest thing is to just turn on all of them. The specific type of exception in OP's example is 0xC0000005, so in theory you could just check that one.

    Forgetting that, I don't bother with those and just click the "Break" button when the crash dialog appears. That puts you in the debugger.

    But in the interests of being fair -- what exactly do you think you did to screw up your debugger? If you've been messing with the property settings, it may be worth starting a new project and copying your source over..... but I'd bet that the same thing would happen again.
    The code is probably displaying undefined behavior. If you change a compiler setting (for instance, optimization level, CRT version, etc) who knows what will happen.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  9. #9
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    Quote Originally Posted by brewbuck View Post
    Just because your code compiles, does not mean it has no bugs.

    The screenshot you posted clearly shows an application crash, with the debugger stopped at a specific line of code. If you don't understand what you are looking at, we can help explain it to you. But if you don't believe me, I'm not sure how I can help.
    no sir, I really appreciate your help, and I did not mean anything bad , I apologize if you got offended or misunderstood my question

  10. #10
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    thank you all guys

  11. #11
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by fouzimedfouni View Post
    no sir, I really appreciate your help, and I did not mean anything bad , I apologize if you got offended or misunderstood my question
    No offense was taken. Hope you solved your problem.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  12. #12
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    Quote Originally Posted by brewbuck View Post
    No offense was taken. Hope you solved your problem.
    YEs I did thank you so much for your help , I bought a book of C++ 1150pages lol , do you recommend me to start with C++ better than C or just continue learning C ?

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you want to learn C then just continue learning C.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Registered User fouzimedfouni's Avatar
    Join Date
    Oct 2014
    Posts
    61
    Quote Originally Posted by laserlight View Post
    If you want to learn C then just continue learning C.
    It looks like its the same for me , IS C++ OOP ?

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    No, C and C++ are different. Yes, C++ has deliberate native support for object oriented programming techniques.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to create .bat file in Visual C++? Ms Visual Studio 2010
    By rousse101 in forum Game Programming
    Replies: 0
    Last Post: 01-25-2015, 04:55 PM
  2. Replies: 1
    Last Post: 02-27-2013, 08:46 PM
  3. Visual Studio DLL and Visual Basic
    By mathguy in forum C Programming
    Replies: 18
    Last Post: 12-08-2011, 03:55 PM
  4. visual studio 6 and visual studio.net difference
    By gemini_shooter in forum Tech Board
    Replies: 5
    Last Post: 02-04-2006, 01:32 AM
  5. Replies: 1
    Last Post: 05-26-2004, 09:59 AM