Answered Unable to Start A Programme!

  • Tuesday, June 12, 2012 5:37 PM
     
     

    Hi every one there!
    I just Installed Microsoft Visual Studio C++ 2010 and When I am trying to Debug a programme I receive the following message!

    "Unable to Start Programe The System couldn't find specified"

    with this message in output:

    1>------ Build started: Project: name, Configuration: Debug Win32 ------
    1>Build started 6/14/2012 10:33:46 AM.
    1>InitializeBuildStatus:
    1>  Touching "Debug\name.unsuccessfulbuild".
    1>ClCompile:
    1>  name.cpp
    1>c:\users\red prince\documents\visual studio 2010\projects\name\name\name.cpp(1): fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:00.30
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    

All Replies

  • Tuesday, June 12, 2012 5:42 PM
     
     Answered

    >1>c:\users\red prince\documents\visual studio 2010\projects\name\name\name.cpp(1): fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory

    Your file should probably have:

    #include <iostream>

    rather than iostream.h

    Dave

  • Tuesday, June 12, 2012 5:44 PM
     
     Answered Has Code

    You cannot start your program because it didn't compile correctly.  Therefore, no executable was made and there is nothing to run.

    Note this line in your output:

    1>c:\users\red prince\documents\visual studio 2010\projects\name\name\name.cpp(1): fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory

    This pretty much says exactly what is going on.  If you double click the line, the IDE will take you right to the offending line and you can fix it.

    It looks, to me, like you are compiling some extremely ancient code, as iostream.h was removed from C++ back in the mid to late 90s.   You probably want to replace it with

    #include <iostream> // no .h
    using namespace std;

    There is a good chance that other code from that era will need fixing as well.  Especially if it was for Visual C++ (which at that time was not particularly C++ standard compliant)

  • Thursday, June 21, 2012 9:59 AM
     
     

    Now I am facing the following problem!!

    1>------ Build started: Project: number, Configuration: Debug Win32 ------
    1>Build started 6/23/2012 2:57:02 AM.
    1>InitializeBuildStatus:
    1>  Touching "Debug\number.unsuccessfulbuild".
    1>ClCompile:
    1>  n-4.cpp
    1>c:\users\red prince\documents\visual studio 2010\projects\number\number\n-4.cpp(10): error C2228: left of '.substr' must have class/struct/union
    1>          type is 'int'
    1>c:\users\red prince\documents\visual studio 2010\projects\number\number\n-4.cpp(10): error C2228: left of '.substr' must have class/struct/union
    1>          type is 'int'
    1>
    1>Build FAILED.
    1>
    1>Time Elapsed 00:00:00.47
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    Here is the code is!!!

    #include <iostream>
    #include "conio.h"
    #include "cstring"
    using namespace std;
    void main()
    {
        int no,number;
    cout<<"Enter A number greater then or equal to 1,000 ";
    cin>>no;
    number=no.substr(0,2) + "," + no.substr(3);
    cout<<number;
    _getch();
    }


    Red Prince!


    • Edited by Red Prince Thursday, June 21, 2012 10:00 AM
    •  
  • Thursday, June 21, 2012 10:42 AM
     
     
    #include <iostream>
    #include "conio.h"
    #include "cstring"
    using namespace std;
    void main()
    {
        int no,number;
    cout<<"Enter A number greater then or equal to 1,000 ";
    cin>>no;
    number=no.substr(0,2) + "," + no.substr(3);
    cout<<number;
    _getch();
    }
    Surely this is not your actual code. Shouldn't no and number be of type string?
     
    Try like this
     
    #include <iostream>
    #include <conio.h> // use angle brackets for library includes
    //#include <cstring> // you don't need this
    #include <string> // you do need this
     
    using namespace std;
     
    int main() // not void main()
    {
      string no, number; // changed type to string
      cout << "Enter A number greater then or equal to 1,000 ";
      cin >> no;
      number = no.substr(0,2) + "," + no.substr(3);
      cout << number;
      _getch();
      return 0;
    }
     

    David Wilkinson | Visual C++ MVP
  • Saturday, June 23, 2012 6:42 PM
     
     

    #include <iostream>
    #include "conio.h"
    #include "cstring"
    using namespace std;
    void main()
    {
        int no,number;
    cout<<"Enter A number greater then or equal to 1,000 ";
    cin>>no;
    number=no.substr(0,2) + "," + no.substr(3);
    cout<<number;
    _getch();
    }

    Surely this is not your actual code. Shouldn't no and number be of type string?
     
    Try like this
     
    #include <iostream>
    #include <conio.h> // use angle brackets for library includes
    //#include <cstring> // you don't need this
    #include <string> // you do need this
     
    using namespace std;
     
    int main() // not void main()
    {
      string no, number; // changed type to string
      cout << "Enter A number greater then or equal to 1,000 ";
      cin >> no;
      number = no.substr(0,2) + "," + no.substr(3);
      cout << number;
      _getch();
      return 0;
    }
     

    David Wilkinson | Visual C++ MVP
    I get it!!1 I do like this and now it works!!!! The problem is that I don't know which header files takes .h and which is not!! also I don't find any site from where I can learn about visual studio!!! I am a new user of this software that's why this is occur!!

    Red Prince!

  • Saturday, June 23, 2012 7:31 PM
     
     

    I get it!!1 I do like this and now it works!!!! The problem is that I don't know which header files takes .h and which is not!!

    This is all spelled out in the online MSDN Library.

    For cout, for example, look at http://msdn.microsoft.com/en-us/library/bzbx67e8%28v=vs.100%29.aspx, and look a the bottom.

  • Saturday, June 23, 2012 9:15 PM
     
     
    >I don't find any site from where I can learn about visual studio!

    Surely you jest?

    Learn Visual C++
    http://msdn.microsoft.com/en-US/vstudio/hh386302

    "How Do I?" Videos for Visual C++
    http://msdn.microsoft.com/en-ca/visualc/bb496952.aspx

    MFC Concepts
    http://msdn.microsoft.com/en-us/library/kkcb3t0w%28v=VS.100%29.aspx

    VC++ Tutorial for Beginners
    http://cnx.org/content/m14425/latest/

    - Wayne