Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

[C++] error: File cannot be found

  1. Feb 2, 2013 #1
    So I just started teaching myself C++ using visual studio 2010. I started with a nice easy program.

    First thing I did was created a new project called "Tutorial." Under source files I right clicked and selected add -> new item, I named it Introduction.cpp. I created this:

    #include <iostream>
    using namespace std;

    int main ()
    {
    cout << "Hello World";
    cout << endl;
    cout << "My name is Neil";

    system("pause");
    return 0;
    }



    Worked out fine. It compiled and ran properly.

    So I added another item and named it variables.cpp and made this:

    #include <iostream>
    using namespace std;

    int main ()
    {
    int a, b, c;
    int sum;


    a=1;
    b=2;
    c=3;
    a=a+4;
    sum = a+b+c;


    cout << sum;
    system("pause");
    return 0;

    }

    This time when I compile and run I get an error Unable to start program "Tutorials/Debug/Tutorial.exe the system in the file cannot be found.

    So I go back and try the other program and i get the same error. A lot of people online say to check the Debug file and look for it, but I didn't find any. I did find tutorial.exe.imbed.manifest though. I don't really know what's going on or how to fix this.
     
  2. jcsd
  3. Feb 2, 2013 #2
    Re: error: File cannot be found

    Are you building a project with two main() functions? That should result in a linking error.
     
  4. Feb 2, 2013 #3
    Re: error: File cannot be found

    Ah that makes sense. I actually fixed it by just making another project with variables instead. So now I have a projected name introduction and a project named variables. My question now is, can I have two different codes in a project using no main function, like name one of them function_one () and the other function_two () (or even main)?
     
  5. Feb 3, 2013 #4
    Re: error: File cannot be found

    Your source must contain one main() function. This is the program's entry point. What you name other functions in the same source file or in different source files in the same project is up to you.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: [C++] error: File cannot be found
  1. Issues with C++ errors? (Replies: 13)

Loading...