Menu

Can compile source codes, but not projects.

2009-04-20
2012-09-26
  • Anna Wojtowicz

    Anna Wojtowicz - 2009-04-20

    (1) I am using Windows XP Pro SP2 & Dev-C++ 4.9.9.2

    (2) My trouble isn't very code-specific, but seems to apply to all projects in general. For the sake of easiness, let's use the Hello World project installed by default (...\Examples\Hello\Hello.dev).

    include <iostream>

    using namespace std;

    int main (int argc, char *argv[])
    {
    char quit;

    quit = '\0';
    while (quit != 'q')
    {
        cout &lt;&lt; &quot;Hello ! This is a console app.&quot; &lt;&lt; endl;
        cout &lt;&lt; &quot;To create a console, go to Project Options and select&quot; &lt;&lt; endl;
        cout &lt;&lt; &quot;\'Win32 Console\'.&quot; &lt;&lt; endl;
        cout &lt;&lt; &quot;Press q to quit &quot; &lt;&lt; endl;
        cin &gt;&gt; quit;
    }
    
    return 0;
    

    }

    (3) Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Examples\Hello\Makefile.win"
    Executing make...
    make.exe -f "C:\Dev-Cpp\Examples\Hello\Makefile.win" all
    g++.exe -c Hello.cpp -o Hello.o -I"C:/Dev-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-CPP/include/c++/3.4.2/backward" -I"C:/Dev-CPP/include/c++/3.4.2/mingw32" -I"C:/Dev-CPP/include/c++/3.4.2" -I"C:/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


    My trouble is this:

    I am able to compile and run individual source codes in any directory on my harddrive, but can only compile and run projects files in my C:\ directory. My first suspicion was perhaps that I was using directories with spaces, and tried a project file in a space-less directory path, but no avail. I also verified my PATH variable is including Dev-C++'s bin directory, because a bunch of (ultimately useless) googling suggested I do this.

    When trying to compile and run a project anywhere but the C:\ directory, I encounter one of two situations:

    A.) The compiler log posted above. Project simply does not compile, and I am given: "[Build Error] [Hello.o] Error 1". Always the same error for any project.

    OR

    B.) According to the progress dialog and compiler log, everything compiles without a hitch. Next, when I try to run my program, a warning box pops up and says: "Project is not compiled". Nothing else, no error messages, just that.

    (I wasn't able to nab the compiler log as I can't duplicate this situation now, but I do recall the log finishing with "Compilation successful".)

    I'm (reluctantly) managing by working on projects in my C:\ dir, but obviously it's totally undesirable. What is the significance of being able to compile and run projects successfully only in the C:\ directory? And can anyone shed any insight on these two situations I'm encountering when I try to work in any other directory?

     
    • cpns

      cpns - 2009-04-22

      In the wonderful way this forum does, it seems to have munged the post order, So I am repeating my last post here so it is not missed and to avoid confusion:

      Firstly, thanks for taking the trouble to perform the tests and changes I suggested. It may seem that they did not help, but they did discount a number of known issues, which is progress of a kind and allows us to concentrate on your problem.

      Normally when the makefile is executed, the working directory remains that from which the makefile was started. In your case it appears that it is somehow switched to the drive root. Note that makefile.win is generated by Dev-C++ from the .dev file. If you delete it, you will have to run the build at least once from Dev-C++ to regenerate it; thereafter you can do a command line build.

      At this point all I can suggest is that you post the generated makefile.fin (it is plain text). And possibly the .dev file (also plain text).

      There are some problems that we never seem to get to the bottom of on this forum, and yours is looking remarkably similar to one of those!

      I am not sure if it is relevant, but do you have admin user rights on the PC you are using?

      > however a compsci course I'm currently taking is tailored to using Dev-C++

      That is one of the few reasons for continuing with Dev-C++, but you might try to encourage your faculty to review their course resources. I would suggest that there are few reasons for not using MSVC++ 2008 Express Edition.

      Clifford

       
      • Anna Wojtowicz

        Anna Wojtowicz - 2009-04-25

        Aw man, I figured it out.

        Following your last post, I started thinking of what would cause the compiler to always want to jump back to the C drive. After some digging around my system, I realized at some point I had the excellent (except not excellent) idea to automatically precede all batch scripts with a "cd C:".

        facepalm

        Thanks for the effort in trying to help me with my problem, but looks like this one wasn't really related to Dev-C++ at all.

        Cheers!

        Anna

         
    • cpns

      cpns - 2009-04-20

      Dev-C++ has a strange bug whereby projects in c:\dev-cpp and subfolders thereof fail to build. Often it works, but often it does not; which is odd, but true.

      Now even if this were not so, building your projects in the installation folder is just a bad idea in any case. And building the examples in there original folders is also a bad idea. because one day (after you have screwed them up perhaps) you might want to get back to the original code; and unless you happen to use a version control system, you would have to reinstall Dev-C++ just to do that.

      So what you should do is copy the examples folder to a new folder; c:\devprojects\ for example, and build them there.

      > I also verified my PATH variable is including Dev-C++'s bin
      > directory, because a bunch of (ultimately useless) googling
      > suggested I do this.

      Not necessary if you build from the IDE and you have no other GNU toolchain installed. But harmless. That said it does enable you to build from the command line, which you may need to try in investigating this problem. To do that, open a cmd console, go to the project's folder and type:

      make -fmakefile.win

      if that succeeds it is likely a Dev-C++ issue rather than a toolchain issue.

      > A.) The compiler log posted above. Project simply does
      > not compile, and I am given: "[Build Error] [Hello.o]
      > Error 1". Always the same error for any project.

      Unfortunately because of the bug I mentioned above, that may be a bad example. I cannot tell if you have encountered the known bug or some other problem (or both!)

      When you do move your project, besure to delete the makefile.win file to force it to be regenerated, and do a "Rebuild All" to ensure everything is rebuilt at the new location.

      > B.) According to the progress dialog and compiler log,
      > everything compiles without a hitch. Next, when I try to
      > run my program, a warning box pops up and says:
      > "Project is not compiled". Nothing else, no error messages,
      > just that.

      I am afraid you would have to post the log from just such an example an let us be the judge of whether everyting was good with the log. The log can tell us far more that just whether there were compiler errors or not.

      If you built that in the Dev-C++ installation folder too, one manifestation of the aforementioned but is that the IDE cannot run the generated executable (I guess it gets the path wrong). One way to determine that is to go directly to teh projects directory and see if a .exe file was actually generated, and if it was try running it directly rather than through the IDE.

      > And can anyone shed any insight on these two situations
      > I'm encountering when I try to work in any other
      > directory?
      Well you failed to reproduce the log for one situation, and the other example has a known problem. I suggest that you post a different failure example avoiding at least the known problems (i.e. folder with no spaces, not a subfolder of the installation directory, and a clean build - delete makefile.win and Rebuild All). If that still fails, post the log; at least we may then distinguish your problem from a number of other possibilities.

      Finally, if you need to get work done, and you have no compelling reason to use Dev-C++, there are better alternatives. Dev-C++ is not maintained, and has known problems that will probably never be addressed. By definition any interested users who might be interested in maintaining Dev-C++ are C/C++ developers; but Dev-C++ is written in Delphi, so it is unlikely that anyone will seriously take it on. Especially in the face of better and more modern alternatives. In software, it is easy to become obsolete by standing still and that is what Dev-C++ has become. The reduction in traffic at this forum is testimony to that. Or it may just be testimony to me pointing out the alternatives. ;-)

      It has to be said in Dev-C++'s defence. When it does work it is smaller, faster, and more straightforward than most of the alternatives. But in the end, that does not count for much, and certainly does not outweigh a working, reliable and fully featured debugger - which will save you far more time that fast IDE start-up and simple project configuration!

      Clifford

       
      • Anna Wojtowicz

        Anna Wojtowicz - 2009-04-21

        I should probably mention I have since tried a clean re-install of Dev-C++ since my last post (following the thread posted elsewhere on the forums), but the results are still the same. Also, I don't actually work within the Dev-C++ install dir, it was just an example. The results of compiling inside or outside the install dir have been identical, so I don't imagine I'm experiencing the bug you mentioned.

        But, at your suggestion I did go ahead and try to rebuild and compile the Hello example elsewhere using the IDE (note the directory paths contain no spaces), and encountered the same results upon rebuilding:

        Compiler: Default compiler
        Building Makefile: "C:\Projects\Hello\Makefile.win"
        Executing make clean
        rm -f Hello.o Hello.exe

        g++.exe -c Hello.cpp -o Hello.o -I"C:/Dev-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-CPP/include/c++/3.4.2/backward" -I"C:/Dev-CPP/include/c++/3.4.2/mingw32" -I"C:/Dev-CPP/include/c++/3.4.2" -I"C:/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


        So I went ahead and tried via command line:

        Microsoft Windows XP [Version 5.1.2600]
        (C) Copyright 1985-2001 Microsoft Corp.

        C:\&gt;cd projects\hello

        C:\Projects\Hello>make -fmakefile.win
        g++.exe -c Hello.cpp -o Hello.o -I"C:/Dev-CPP/lib/gcc/mingw32/3.4.2/include" -I
        "C:/Dev-CPP/include/c++/3.4.2/backward" -I"C:/Dev-CPP/include/c++/3.4.2/mingw32
        " -I"C:/Dev-CPP/include/c++/3.4.2" -I"C:/Dev-CPP/include"
        g++.exe: Hello.cpp: No such file or directory
        g++.exe: no input files
        make: *** [Hello.o] Error 1

        C:\Projects\Hello>


        In both cases the only file generated is a Makefile.win file. As I had suggested in my previous post and is the case again, these two scenarios still hold true: executing the Hello.cpp file independently of the project is always successful regardless of location, and, moving the Hello.dev project to the C:\ dir will render no errors and allow it to compile and execute successfully.

        I'd imagine this affiliation to the C:\ dir should be some sort of indicator of... something magical; what's so special about C:\ over any other location?

        And I do realize Dev-C++ is approaching a state of stagnancy, and I probably should start looking to alternative IDEs at some point, however a compsci course I'm currently taking is tailored to using Dev-C++; just seems simplest to me to use Dev-C++ if possible.

         
      • Anna Wojtowicz

        Anna Wojtowicz - 2009-04-21

        I should probably mention I have since tried a clean re-install of Dev-C++ since my last post (following the thread posted elsewhere on the forums), but the results are still the same. Also, I don't actually work within the Dev-C++ install dir, it was just an example. The results of compiling inside or outside the install dir have been identical, so I don't imagine I'm experiencing the bug you mentioned.

        But, at your suggestion I did go ahead and try to rebuild and compile the Hello example elsewhere using the IDE (note the directory paths contain no spaces), and encountered the same results upon rebuilding:

        Compiler: Default compiler
        Building Makefile: "C:\Projects\Hello\Makefile.win"
        Executing make clean
        rm -f Hello.o Hello.exe

        g++.exe -c Hello.cpp -o Hello.o -I"C:/Dev-CPP/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-CPP/include/c++/3.4.2/backward" -I"C:/Dev-CPP/include/c++/3.4.2/mingw32" -I"C:/Dev-CPP/include/c++/3.4.2" -I"C:/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


        So I went ahead and tried via command line:

        Microsoft Windows XP [Version 5.1.2600]
        (C) Copyright 1985-2001 Microsoft Corp.

        C:\&gt;cd projects\hello

        C:\Projects\Hello>make -fmakefile.win
        g++.exe -c Hello.cpp -o Hello.o -I"C:/Dev-CPP/lib/gcc/mingw32/3.4.2/include" -I
        "C:/Dev-CPP/include/c++/3.4.2/backward" -I"C:/Dev-CPP/include/c++/3.4.2/mingw32
        " -I"C:/Dev-CPP/include/c++/3.4.2" -I"C:/Dev-CPP/include"
        g++.exe: Hello.cpp: No such file or directory
        g++.exe: no input files
        make: *** [Hello.o] Error 1

        C:\Projects\Hello>


        In both cases the only file generated is a Makefile.win file. As I had suggested in my previous post and is the case again, these two scenarios still hold true: executing the Hello.cpp file independently of the project is always successful regardless of location, and, moving the Hello.dev project to the C:\ dir will render no errors and allow it to compile and execute successfully.

        I'd imagine this affiliation to the C:\ dir should be some sort of indicator of... something magical; what's so special about C:\ over any other location?

        And I do realize Dev-C++ is approaching a state of stagnancy, and I probably should start looking to alternative IDEs at some point, however a compsci course I'm currently taking is tailored to using Dev-C++; just seems simplest to me to use Dev-C++ if possible.

         
    • cpns

      cpns - 2009-04-21

      Firstly, thanks for taking the trouble to perform the tests and changes I suggested. It may seem that they did not help, but they did discount a number of known issues, which is progress of a kind and allows us to concentrate on your problem.

      Normally when the makefile is executed, the working directory remains that from which the makefile was started. In your case it appears that it is somehow switched to the drive root. Note that makefile.win is generated by Dev-C++ from the .dev file. If you delete it, you will have to run the build at least once from Dev-C++ to regenerate it; thereafter you can do a command line build.

      At this point all I can suggest is that you post the generated makefile.fin (it is plain text). And possibly the .dev file (also plain text).

      There are some problems that we never seem to get to the bottom of on this forum, and yours is looking remarkably similar to one of those!

      I am not sure if it is relevant, but do you have admin user rights on the PC you are using?

      > however a compsci course I'm currently taking is tailored to using Dev-C++

      That is one of the few reasons for continuing with Dev-C++, but you might try to encourage your faculty to review their course resources. I would suggest that there are few reasons for not using MSVC++ 2008 Express Edition.

      Clifford

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.