I am using windows xp and dev-c++ 4.9.9.2, the one that comes with compiler.
My devcpp can't compile projects. What I mean is, when I compile only the source code file, it works. But when I start a blank project, add a source code file with the same code, it does not compile. In the "compiler" tab it says
"C:\Cprog\test\Makefile.win [Build Error][hello.o] Error 1"
And in the "compile log", there is only one error, and it says:
Compiler: Default compiler
Building Makefile: "C:\Cprog\test\Makefile.win"
Executing make...
make.exe -f "C:\Cprog\test\Makefile.win" all
gcc.exe -c hello.c -o hello.o -I"C:/Dev-Cpp/include"
gcc.exe: hello.c: No such file or directory
gcc.exe: no input files
make.exe: *** [hello.o] Error 1
Execution terminated
Here's the code, it's just a simple Hello World:
include<stdio.h>
int main(void)
{
printf("Hello, Man!");
return (0);
return (0);
}
I have no idea what had gone wrong, and anyone help me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am frustrated, how and where should I configure to get the compilling goes right?
I've tried sth new. If I save the project file under c:\, no matter where I place the source code file, I can still compile without an error, but not vice versa. However once I put the project file in some folder, for say "c:\cprog\test", it will gives the same error as on the first post!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-25
Describe the exact steps you took to create the project.
Have you fried removing hello.c from the project and re-adding it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We did not get to the bottom of that one unfortunately, and he had assignments to do so he was directed to an alternative development tool. He'd used Eclipse for Java development, so he went for Eclipse/CDT.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is how I created the project:
File > New > Project...
Choosing Empty Project, C Project, naming it as "hello", click ok
Save it to "C:\Cprog\test\"
then go to the Project Browser, right click, new file, type the code, save it as "hello.c"
Compile....oops error
I've tried to remove hello.c and re-add it, but that doesn't help. Also, I tried to have a clean reinstall, doesn't help. I also tried to install the ver4 and compile the same project. ohohohoh it works! But... I don't want to use this old version...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-26
>> ...save it as "hello.c"
Save it where? (Not that that should matter I grant you).
>> I don't want to use this old version...
No your really don't!
Have you tried rather than creating an Empty project, using one of the project templates? Again, it should make no difference but it may inform the investigation.
Have you tried building from the command line?: Open a Comand console, and:
> cd <project path>
> path=c:\dev-cpp\bin;%path%
> make -fmakefile.win clean
> make -fmakefile.win all
Now the underlying compiler is MinGW/GCC (www.mingw.org), you can of course use this, or the toolchain provided with Dev-C++ from within other environments is necessary. It dependes whether it is the compiler you are partial to or the IDE.
As I said yours appears to be the second system reported that has this problem, and teh solution is currently unknown, so we are all shoorting in the dark.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>>Have you tried rather than creating an Empty project, using one of the project templates? Again, it should make no difference but it may inform the investigation.
I have. It make no difference if I compile the project. But when I compile (the hello world sample from the templates) the source code only, it can compile.
>>have you tried building from the command line?: Open a Comand console, and: ......
I've just tried. I gives the same error message as in the first post.
Now after trying the command line, I am thinking there is sth wrong with the Makefile.win generated by dev-cpp, because the error message says it can't find "hello.c" So I tried some different things.
I deleted everything in c:\cprog\test. Then I create a new project "hello", and new source code "hello.c" under the same folder. As I compile it, same error message as on the first post.
Then, I tried to make a copy of the source code to the root ("c:\"), where all the files under c:\cprog\test remains unchanged. As I compile the project in c:\cprog\test, it "can" compile! Now, the "Makefile.win" is under c:\cprog\test\, but the the "hello.o", and "hello.exe" is under the root c:\ !!!
I put the wrong information in post 4, sorry.
The next thing I do is modify the Makefile.win
I named the modified one Makefile_abs.win using notepad. And changing the path of all "hello.c" and "hello.o" to absolute path "c:\cprog\test\hello.c" and "c:\cprog\test.hello.o" while does not change the path of "hello.exe".
Under "Project browser", I right click the project, and click the "Project option". Under this windows, I go to the "Makefile" tab and check "Use custom makefile" and of coz add the path of the modified "Makefile_abs.win" And of coz remove all related files under c:.
As I compile it. It works! Now, the "hello.o" is under c:\cprog\test while "hello.exe" is under c:\
As you may know, I just find out the "Makefile_abs.win" that is in the post does not work if you just directly copy it because the forum changed the format a bit.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-26
>> I just find out the "Makefile_abs.win" that is in the post does not work if you just directly copy it
Yes the forum removes multiple whitespace and hard tabs, and tabs are significant in makefiles.
Frankly this is very weird, It is as if the current working directory is being set to c:\ instead of the project folder. I have no explanation, but perhaps a work-around. Create a file cwd.mak containing the following make rule (replace <tab> with a tab character, make sure your editor is not set to use spaces for tabs - use notepad just to be sure perhaps)
all-before :
<tab>cd c:\cprog\test\
Then in the makefile setup, add cwd.mak and a makefile 'include'. Dev-C++ calls the all-before rule automatically if one exists as it is the first dependency of the 'all' rule.
Of course if this works, you will need to create such a file for each project.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, the method doesn't work out. But well, now I know it's the problem of my pc. Thanks a lot for your help Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2007-02-28
Didn't work out because my instructions were incorrect (they were off the top of my head), or didn't work out because the CD was executed did not appear to work?
The build log should show the execution of the CD if the rule was correctly invoked - does it?
To be honest though, if it is this hard, you should use a different tool!
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am using windows xp and dev-c++ 4.9.9.2, the one that comes with compiler.
My devcpp can't compile projects. What I mean is, when I compile only the source code file, it works. But when I start a blank project, add a source code file with the same code, it does not compile. In the "compiler" tab it says
"C:\Cprog\test\Makefile.win [Build Error] [hello.o] Error 1"
And in the "compile log", there is only one error, and it says:
Compiler: Default compiler
Building Makefile: "C:\Cprog\test\Makefile.win"
Executing make...
make.exe -f "C:\Cprog\test\Makefile.win" all
gcc.exe -c hello.c -o hello.o -I"C:/Dev-Cpp/include"
Here's the code, it's just a simple Hello World:
include<stdio.h>
int main(void)
{
printf("Hello, Man!");
return (0);
return (0);
}
I have no idea what had gone wrong, and anyone help me?
In my code I accidentally type in an extra "return (0);", but whether the extra one is there or not, the problem is the same.
>> make.exe: *** [hello.o] Error 1
Simply means that the build failed. You have to read teh log to find out why. In this case the cause is
>> gcc.exe: hello.c: No such file or directory
>> gcc.exe: no input files
Clifford
I am frustrated, how and where should I configure to get the compilling goes right?
I've tried sth new. If I save the project file under c:\, no matter where I place the source code file, I can still compile without an error, but not vice versa. However once I put the project file in some folder, for say "c:\cprog\test", it will gives the same error as on the first post!
Describe the exact steps you took to create the project.
Have you fried removing hello.c from the project and re-adding it?
This looks very like the problem this guy had: http://sourceforge.net/forum/message.php?msg_id=3906018
We did not get to the bottom of that one unfortunately, and he had assignments to do so he was directed to an alternative development tool. He'd used Eclipse for Java development, so he went for Eclipse/CDT.
Clifford
This is how I created the project:
File > New > Project...
Choosing Empty Project, C Project, naming it as "hello", click ok
Save it to "C:\Cprog\test\"
then go to the Project Browser, right click, new file, type the code, save it as "hello.c"
Compile....oops error
I've tried to remove hello.c and re-add it, but that doesn't help. Also, I tried to have a clean reinstall, doesn't help. I also tried to install the ver4 and compile the same project. ohohohoh it works! But... I don't want to use this old version...
>> ...save it as "hello.c"
Save it where? (Not that that should matter I grant you).
>> I don't want to use this old version...
No your really don't!
Have you tried rather than creating an Empty project, using one of the project templates? Again, it should make no difference but it may inform the investigation.
Have you tried building from the command line?: Open a Comand console, and:
> cd <project path>
> path=c:\dev-cpp\bin;%path%
> make -fmakefile.win clean
> make -fmakefile.win all
If it works post the whole seeeion log (see how to copy&patse from a console at http://sourceforge.net/forum/message.php?msg_id=4138326 )
Now the underlying compiler is MinGW/GCC (www.mingw.org), you can of course use this, or the toolchain provided with Dev-C++ from within other environments is necessary. It dependes whether it is the compiler you are partial to or the IDE.
As I said yours appears to be the second system reported that has this problem, and teh solution is currently unknown, so we are all shoorting in the dark.
Clifford
>>Have you tried rather than creating an Empty project, using one of the project templates? Again, it should make no difference but it may inform the investigation.
I have. It make no difference if I compile the project. But when I compile (the hello world sample from the templates) the source code only, it can compile.
>>have you tried building from the command line?: Open a Comand console, and: ......
I've just tried. I gives the same error message as in the first post.
Now after trying the command line, I am thinking there is sth wrong with the Makefile.win generated by dev-cpp, because the error message says it can't find "hello.c" So I tried some different things.
I deleted everything in c:\cprog\test. Then I create a new project "hello", and new source code "hello.c" under the same folder. As I compile it, same error message as on the first post.
Then, I tried to make a copy of the source code to the root ("c:\"), where all the files under c:\cprog\test remains unchanged. As I compile the project in c:\cprog\test, it "can" compile! Now, the "Makefile.win" is under c:\cprog\test\, but the the "hello.o", and "hello.exe" is under the root c:\ !!!
I put the wrong information in post 4, sorry.
The next thing I do is modify the Makefile.win
I named the modified one Makefile_abs.win using notepad. And changing the path of all "hello.c" and "hello.o" to absolute path "c:\cprog\test\hello.c" and "c:\cprog\test.hello.o" while does not change the path of "hello.exe".
Under "Project browser", I right click the project, and click the "Project option". Under this windows, I go to the "Makefile" tab and check "Use custom makefile" and of coz add the path of the modified "Makefile_abs.win" And of coz remove all related files under c:.
As I compile it. It works! Now, the "hello.o" is under c:\cprog\test while "hello.exe" is under c:\
>Here is the original "Makefile.win":
Project: hello
Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = hello.o $(RES)
LINKOBJ = hello.o $(RES)
LIBS = -L"lib"
INCS = -I"include"
CXXINCS = -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include"
BIN = hello.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before hello.exe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "hello.exe" $(LIBS)
hello.o: hello.c
$(CC) -c hello.c -o hello.o $(CFLAGS)
>Here is the modified "Makefile_abs.win"
Project: hello
Makefile created by Dev-C++ 4.9.9.2
CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
RES =
OBJ = c:\cprog\test\hello.o $(RES)
LINKOBJ = c:\cprog\test\hello.o $(RES)
LIBS = -L"lib"
INCS = -I"include"
CXXINCS = -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include"
BIN = hello.exe
CXXFLAGS = $(CXXINCS)
CFLAGS = $(INCS)
RM = rm -f
.PHONY: all all-before all-after clean clean-custom
all: all-before hello.exe all-after
clean: clean-custom
${RM} $(OBJ) $(BIN)
$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o "hello.exe" $(LIBS)
hello.o: hello.c
$(CC) -c c:\cprog\test\hello.c -o c:\cprog\test\hello.o $(CFLAGS)
>Here's the Compile log:
Compiler: Default compiler
Building Makefile: "C:\Cprog\test\Makefile.win"
Executing make...
make.exe -f "C:\Cprog\test\Makefile.win" all
gcc.exe hello.o -o "hello.exe" -L"lib"
gcc.exe: hello.o: No such file or directory
gcc.exe: no input files
make.exe: *** [hello.exe] Error 1
Execution terminated
Now after spending a lot of time doing all these, I have a clue what went wrong, but I still don't know a effective way of solve the problem...
Here is the compile log using the the modified "Makefile_abs.win":
Compiler: Default compiler
Executing make clean
rm -f c:\cprog\test\hello.o hello.exe
gcc.exe -c c:\cprog\test\hello.c -o c:\cprog\test\hello.o -I"include"
gcc.exe c:\cprog\test\hello.o -o "hello.exe" -L"lib"
Execution terminated
Compilation successful
As you may know, I just find out the "Makefile_abs.win" that is in the post does not work if you just directly copy it because the forum changed the format a bit.
>> I just find out the "Makefile_abs.win" that is in the post does not work if you just directly copy it
Yes the forum removes multiple whitespace and hard tabs, and tabs are significant in makefiles.
Frankly this is very weird, It is as if the current working directory is being set to c:\ instead of the project folder. I have no explanation, but perhaps a work-around. Create a file cwd.mak containing the following make rule (replace <tab> with a tab character, make sure your editor is not set to use spaces for tabs - use notepad just to be sure perhaps)
all-before :
<tab>cd c:\cprog\test\
Then in the makefile setup, add cwd.mak and a makefile 'include'. Dev-C++ calls the all-before rule automatically if one exists as it is the first dependency of the 'all' rule.
Of course if this works, you will need to create such a file for each project.
Clifford
Unfortunately, the method doesn't work out. But well, now I know it's the problem of my pc. Thanks a lot for your help Clifford
Didn't work out because my instructions were incorrect (they were off the top of my head), or didn't work out because the CD was executed did not appear to work?
The build log should show the execution of the CD if the rule was correctly invoked - does it?
To be honest though, if it is this hard, you should use a different tool!
Clifford