Search code examples
c++cygwinusing

Cygwin "using: command not found" for C++ program


Hoping to free myself from Eclipse and not wanting to keep using the online cpp.sh, I wrote a small program in Cygwin in nano and tried to run it. The code is included for clarity.

#include <iostream>
#include <string>

using namespace std;

int main()
{
  int i;
  string mystr;

  cout << "Enter number: ";
  cin >> i;
  cout << "You entered: " << i;
  cout << " and its double: << i*2 << ".\n";
  cin.ignore();
  cout << "Name: ";
  getline(cin, mystr);
  cout << "Hello " << mystr << ".\n";
  cout << "Team? ";
  getline(cin, mystr);
  cout << "Go " << mystr << "! \n";
  return 0;
}

Trying to run it returns a series of errors, as seen in the picture. Right now, I'm trying to understand why "using" is not recognized. Checking Google found many similar complaints, but never about the command "using," probably because "using" is a common enough word to be using in a different context.


Solution

  • You can't run source code directly. You must compile it first.