2

I am trying now to execute a C++ program in eclipse, but it doesn't show anything, my code is:

#include<iostream.h>
using namespace std;
int main()
 {
    cout<<"i have stucked here, plz do some thing for Me !";
    return 0;
 }

I think I am not ok in setting variable path. It is

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Samsung\Samsung PC Studio 3\;C:\soft\cygwin\bin

while my bin path is

c:\cygwin\bin
Lennart
  • 9,657
  • 16
  • 68
  • 84
  • 1
    Well, did you correct your environment variable then? Also, are you using pure C++, or the Android NDK? – Lennart Dec 29 '12 at 16:18
  • Now it gives this in console, make make: Nothing to be done for all. –  Dec 29 '12 at 16:23
  • @Lennart my cygwin install path is c:\cygwin, and i have set my path is like %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Samsung\Samsung PC Studio 3\;C:\cygwin\bin –  Dec 29 '12 at 16:31
  • @Lennart is my path is ok? please comment so that i could get ride from this problem... –  Dec 29 '12 at 16:31
  • 1
    The cygwin path looks correct now. – Lennart Dec 30 '12 at 11:46
  • @Lennart Thanks ! Now my program runs successfuly but eclipse takes too much time to launch my c/C++ program.. –  Dec 30 '12 at 12:15

2 Answers2

0

Try this:

#include<iostream>
using namespace std;
int main()
 {
    cout<<"I am stuck here, please do some thing for Me !";
    return 1;
 }
Taryn
  • 242,637
  • 56
  • 362
  • 405
Ravi
  • 30,829
  • 42
  • 119
  • 173
  • Can't find a source file at "/cygdrive/c/android programs/Demo1/Demo1.cpp" Locate the file or edit the source lookup path to include its location. –  Dec 29 '12 at 16:22
  • please re-install your IDE. Because, this code is running with the above string output :/ – Ravi Dec 29 '12 at 16:23
  • Now it gives this in console, make make: Nothing to be done for all. –  Dec 29 '12 at 16:25
0

remove ".h" from header iostream.h because now .h forms are deprecated from c++ library.,

this is working fine for me..

       #include<iostream>
       using namespace std;
       int main()
        {
          cout<<"I am stuck here, please do some thing for Me !";
           return 0;
         } 
Taryn
  • 242,637
  • 56
  • 362
  • 405
sourcecode
  • 1,802
  • 2
  • 15
  • 17
  • now i am getting this after your new code: **** Build of configuration Default for project Demo1 **** make all make: Nothing to be done for `all'. –  Dec 29 '12 at 16:29
  • i am getting the above string after your new code, so what is going wrong? –  Dec 29 '12 at 16:33
  • you have given file extension .cpp? and where r u running the code ,in cmd? – sourcecode Dec 29 '12 at 16:36
  • yes i have saved with .cpp and i don't know where this is running i press the run icon above the ide and it shows the console prompt, where i am getting something above code. –  Dec 29 '12 at 16:38
  • try once in cmd. for this firstly , u have to go to ur dir where u have saved the program (eg. by "cd desktop" command), after for compiling type "g++ -o demo demo.cpp" (demo is ur file name), then for run type : "demo" .. then tell me the result ,because it is working for me – sourcecode Dec 29 '12 at 16:44
  • you only have to type "demo" not "demo.cpp" in cmd for running the program. – sourcecode Dec 29 '12 at 17:04
  • i am only getting this **** Build of configuration Debug for project MyFirstProject in C++ **** make all make: Nothing to be done for `all'. –  Dec 29 '12 at 17:19
  • i think there is problem in ur path env variable , add the PATH variable to Run Configuration ,try this link : http://stackoverflow.com/questions/8099445/eclipse-cdt-running-c-program-show-nothing-in-the-console-why – sourcecode Dec 29 '12 at 17:28
  • yeah i made it correct my enviroment variable is variable name : PATH variable value :C:\cygwin\bin –  Dec 29 '12 at 17:50
  • have a look at this also http://www.math.ucla.edu/~anderson/UsingEclipseCPP/index.html – sourcecode Dec 29 '12 at 17:52
  • it aslo gives an errr : Error: NDK PAATH CAN'T CONTAIN SPACE –  Dec 29 '12 at 17:58
  • did ur directory name has spaces ,if yes then correct it..alo thoroughlt read this manual ,this wud help u a lot http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_run_env.htm – sourcecode Dec 29 '12 at 18:01
  • if that is not helping either then move MinGW out of the Program Files directory. Make sure its directory contains no spaces! This is the last solution for this problem then. – sourcecode Dec 29 '12 at 18:07
  • ok, thanks for your long conversation, i'll try myself to make it correct, i'll not disturb YOu... –  Dec 29 '12 at 18:10