Thread: Starting with Dev C ; a problem

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Starting with Dev C ; a problem

    When trying to compile an example program I get this error :

    ================================================== ===================
    Compiler: Default compiler
    Building Makefile: "D:\Dev-Cpp\Examples\Hello\Makefile.win"
    Executing make...
    make.exe -f "D:\Dev-Cpp\Examples\Hello\Makefile.win" all
    g++.exe -c Hello.cpp -o Hello.o -I"D:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"D:/Dev-Cpp/include/c++/3.4.2/backward" -I"D:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"D:/Dev-Cpp/include/c++/3.4.2" -I"D:/Dev-Cpp/include"

    g++.exe: Hello.cpp: No such file or directory
    g++.exe: no input files

    make.exe: *** [Hello.o] Error 1

    Execution terminated
    ================================================== ====================

    what could be the problem?

    I'm using ver 4.9.9.2


    image: <img>http://img504.imageshack.us/img504/4526/screenxh3.gif</img>

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    g++.exe: Hello.cpp: No such file or directory
    It can't "find" your Hello.cpp file. Either, you didn't save it, you saved it in the "wrong place", or you need to set-up your paths differently. As an experiment, you might try putting Hello.cpp in the root directory on your C-drive.

    I don't use Dev-C++, so I can't tell you exactly how to fix this problem. It's a popular compiler/IDE, so someone should be able to help you with it.

    Hang in there! Every time I've tried a new compiler, there have been snags.. I'm happy if I can get Hello World working on the first day.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    6
    As an experiment, you might try putting Hello.cpp in the root directory on your C-drive.
    I did that, not solved

  4. #4
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Iv never seen that error but it could be that somthing was not installed. You could uninstall it and re-install it again.
    Double Helix STL

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    18
    I'm also using Dev-C++ but I've never used make.exe before so I'm not too sure how much this is going to help.

    I'm relatively familiar with the file functions (fopen(), etc) and I know that with those functions the file has to be in the same folder as the program that you are running, so try moving Hello.cpp to the same folder that you are running your program from.

  6. #6
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    I've somehow also managed to break my dev CPP even though it was working a few secs ago. I however get the error that several re-install won't fix.
    There doesn't seem to be GNU Make file in PATH or in Dev C++'s bin path. Please make sure that you have GNU make and adjust Bin setting or system PATH environment variable and that make setting in Compiler Option contains correct filename, otherwise you'll not be able to compile anything.
    I've added the path to the Make exe to my system path variable
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  7. #7
    Registered User
    Join Date
    Jan 2007
    Location
    Euless, TX
    Posts
    144
    I have used Dev-C++ ---- why use a makefile? Sort of begs the question as to why you're using an IDE to compile and build your program. Or are you just using Dev tp edit the program and the GNU compiler to make it?

  8. #8
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Make sure you are actually IN the "D:\Dev-Cpp\Examples\Hello\" directory before you run the make. The error message is very clear: Hello.cpp cannot be found. I see no evidence that make attempted to change directories, so unless you were already in the right place, it's not going to find the source file.

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Newer versions of Dev-C++ use make whenever you create a project, AFAIK. The OP probably just tried to compile a simple hello, world program and came across this error.

    As a suggestion, try putting your source file in D:\ (which you may already have tried) or in D:
    Dev-Cpp\Bin. Or try re-creating the project file. Or edit the project file yourself: where ever it says Hello.*, insert the full path to the source file before the filename.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    Registered User
    Join Date
    Jan 2007
    Posts
    89
    Or maybe you could just use code::blocks
    Ive never had probelms with it.

  11. #11
    Registered User
    Join Date
    Nov 2007
    Posts
    6
    Iv never seen that error but it could be that somthing was not installed. You could uninstall it and re-install it again
    Iv done that twice

    I'm relatively familiar with the file functions (fopen(), etc) and I know that with those functions the file has to be in the same folder as the program that you are running, so try moving Hello.cpp to the same folder that you are running your program from
    Tried, negative result

    I've added the path to the Make exe to my system path variable
    How do I do that?

    Or are you just using Dev tp edit the program and the GNU compiler to make it?
    I'm using the Dev C IDE

    Make sure you are actually IN the "D:\Dev-Cpp\Examples\Hello\" directory before you run the make. The error message is very clear: Hello.cpp cannot be found. I see no evidence that make attempted to change directories, so unless you were already in the right place, it's not going to find the source file.
    I copied the files to that bin directory, same result

    code::blocks
    I'm sorry I don't understand

  12. #12
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Code::Blocks is an alternative to Dev-C++. It has more features and is generally a better program. You could try it out if you wanted to. codeblocks.org

    Anyway . . . as another experiment, try opening a command prompt (Start->Accessories->Command Prompt, usually), CD'ing to the location of your .cpp file, and compiling the file by hand. Something like this might happen:
    Code:
    C:\Windows>cd "\Documents and Settings\User\cpp"
    
    C:\Documents and Settings\User\cpp>g++ hello.cpp -o hello.exe
    Command not found
    
    C:\Documents and Settings\User\cpp>D:\Dev-Cpp\Bin\g++ hello.cpp -o hello.exe
    ... some weird g++ error ...
    
    C:\Documents and Settings\User\cpp>set PATH=D:\Dev-Cpp\Bin;&#37;PATH%
    
    C:\Documents and Settings\User\cpp>g++ hello.cpp -o hello.exe
    
    C:\Documents and Settings\User\cpp>hello
    Hello, World!
    
    C:\Documents and Settings\User\cpp>exit
    Try something like that and see what happens. What error messages do you get?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  13. #13
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I might be wrong but DevCpp (and MingW) may not work well if
    1) it is installed to a directory whose name contains spaces (e.g Program Files),
    2) the source path contains spaces
    3) the source is located in the same directory as DevCpp.

    I think the last one may apply here.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  14. #14
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by anon View Post
    I might be wrong but DevCpp (and MingW) may not work well if
    1) it is installed to a directory whose name contains spaces (e.g Program Files),
    That's true, it might not -- but in this case, Dev-C++ is installed in the default location: \Dev-Cpp.
    2) the source path contains spaces
    Again, possibly true -- but when the source file is located in the root of the drive, this shouldn't be a problem.
    3) the source is located in the same directory as DevCpp.

    I think the last one may apply here.
    On the contrary -- it might work better. At least that was my thought.

    Anyway, it's irrelevant -- the OP has tried in the same directory and elsewhere, apparently.

    @OP: Did you modify your path at all? Did Dev-C++ do it automatically? Are you using Windows Vista?

    You can check your path by typing "path" at a command prompt.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  15. #15
    Registered User
    Join Date
    Nov 2007
    Posts
    6

    Re:

    I got this when manual compiling :

    Code:
    D:\Dev-Cpp\Examples\Hello>g++ hello.cpp -o hello.exe
    'g++' is not recognized as an internal or external command,
    operable program or batch file.
    
    D:\Dev-Cpp\Examples\Hello>D:\Dev-Cpp\Bin\g++ hello.cpp -o hello.exe
    
    D:\Dev-Cpp\Examples\Hello>hello
    Hello ! This is a console app.
    To create a console, go to Project Options and select
    'Win32 Console'.
    Press q to quit
    q
    
    D:\Dev-Cpp\Examples\Hello>set PATH=D:\Dev-Cpp\Bin;&#37;PATH%
    
    D:\Dev-Cpp\Examples\Hello>g++ hello.cpp -o hello.exe
    
    D:\Dev-Cpp\Examples\Hello>hello
    Hello ! This is a console app.
    To create a console, go to Project Options and select
    'Win32 Console'.
    Press q to quit
    q
    
    D:\Dev-Cpp\Examples\Hello>
    So, it works manually


    I'm using WXP-H
    @OP: Did you modify your path at all? Did Dev-C++ do it automatically? Are you using Windows Vista?
    No, I have this
    Last edited by mabauti; 12-01-2007 at 07:37 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. problem with using for loops with Dev C++
    By indigo0086 in forum C++ Programming
    Replies: 10
    Last Post: 08-10-2005, 11:04 PM
  4. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  5. Words and lines count problem
    By emo in forum C Programming
    Replies: 1
    Last Post: 07-12-2005, 03:36 PM