1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: C++ 2010 not debugging

Discussion in 'Software Development' started by SpectresShadow, Aug 8, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    When I write a program in c++ and try to debug, I get an error pop-up (see attached photo). I have been using just the simple hello world program to try to figure out why it is happening.

    Code:
    #include <iostream>
    using namespace std;
    
    int main()
    {
         cout << "Hello World" << endl;
         system("Pause");
         return 0;
    }
    
    And yes, I know that using the system command is bad convention, but I only use it for debugging. My finished products always have the getch() command in place of system("Pause").

    If anyone has any ideas on what to do, I would appreciate the help. Thanks in advance.
     

    Attached Files:

  2. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    Have you verified that the file does actually exist?
     
  3. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    Yes I have checked and it is not creating that file. I have tried to find wt option would create the files in the options of visual studio and have found nothing. Should I just uninstall and reinstall it or are there any other thoughts. And yes I have the current updates for it, I just updated last night before I posted this and it still did it.
     
  4. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    I'm using VB.net instead of C#, so it may just be different,
    For me the executable would be found in
    ...\HelloWorld\HelloWorld\bin\Debug.

    It may be worth checking whether you get that.

    Also, a search *.exe wouldn't be amiss.

    I'll try to install C# and see if I can figure anything else out.

    Edit: I mean C++. Sorry.
    Second edit: And it won't install. :(
     
  5. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    I have all three visual studio express editions; VB, C++, and C#. Hardly use C# right now, but VB works fine. C++ was working fine 3 months ago, and aside from some windows 7 themes, command and conquer tiberian sun, and DX studio (for a project I am working on with friends, a new mmorpg that is done in the style of classic snes games for looks) I haven't installed anything new on my computer in that time.
     
  6. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    3 months! Do you know how many computers a geek can break in that time? :D

    It may seem like a stupid question, but are you actually building the program?
    As a VB programmer I'm used to just hitting F5 to compile and run, but if (?) I understand correctly for C++ you have to hit F7 first to build. If nothing else, it may be worth building it without executing it to see whether the problem kicks in there. It would make a lot of sense that it can't find the program because the program isn't there.
     
  7. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    Yes I do realize that 3 months is a long time but I had other priorities than to tinker with c++ in those 3 months, such as a job, job hunting, and the game that we are working on, which is primarily realbasic. I've never had to build the program before, while I was at the tech I just had to hit F5 to compile and run just like in vb.
     
  8. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
  9. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    I just noticed that silverlight is no longer on my computer for some reason. Would that have anything to do with it maybe?
     
  10. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    It could do, but I wouldn't have thought so.
    What kind of project is this HelloWorld?

    The CLR Console project that the VC++ generates works fine if you just hit F5
    Whereas as the empty one gives the exact same error message as you report.

    Once I add a .cpp file with your source however, it compiles and works without a problem.
     
  11. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    Also, I notice that there's a "not saved" asterisk by source1.cpp
    I wonder whether that may be a significant clue. I thought that the environment automatically saves the file before compilation. Is there something strange about where the source file is located for example?
     
  12. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    I checked all the options for that not saved asterisk and all that would do anything about it were set to save. What I did was open a new empty project, File, Open, File, and then typed the source. It worked that way all through the time at the tech. And that was the way I was told I am supposed to create a new project.
     
  13. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    What file did you open?

    If you want to create a new project you need the files involved to be part of that project. Better would be to create a new file from within the project.
    Right Click on the project (HelloWorld) in the Solution Explorer
    Click on ADD then on New Item
    Create CPP file.

    It should automatically appear under Source files.

    Then type your source.
     

    Attached Files:

    • C++.jpg
      C++.jpg
      File size:
      108.9 KB
      Views:
      71
  14. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    I have to sign off for the night; if that doesn't crack the problem I'll check back in the morning.
     
  15. SpectresShadow

    SpectresShadow Thread Starter

    Joined:
    Aug 3, 2012
    Messages:
    121
    Oops. I meant File, New, File, .cpp file. Sorry.
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1064366