469,271 Members | 1,009 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

during compilation of a program its showing error that "recipe for target 'mainn.o' f

6
during compilation of a program its showing error that "line 28",, G:\aa\Makefile.win
" recipe for target 'main.o' failed"
please help me how to debug it..
Jul 25 '15 #1
11 15660
weaknessforcats
9,208 Expert Mod 8TB
Where did you get the makefile?
Jul 25 '15 #2
Abhik
6
its installed in that DEV C++ software
Jul 25 '15 #3
weaknessforcats
9,208 Expert Mod 8TB
The makefile is generated based on your project code. Without seeing your code for main(), I can't say for sure but you may not have compiled correctly.

Generating an object file ( a .o) can fail if your code has errors.

Are there any other errors before this one?
Jul 25 '15 #4
Abhik
6
this is the makefile that is generated...

# Project: Project2
# Makefile created by Dev-C++ 5.11

CPP = g++.exe
CC = gcc.exe
WINDRES = windres.exe
OBJ = main.o
LINKOBJ = main.o
LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -pg
INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN = Project2.exe
CXXFLAGS = $(CXXINCS) -ansi -fno-asm -traditional-cpp -pg
CFLAGS = $(INCS) -ansi -fno-asm -traditional-cpp -pg
RM = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CC) $(LINKOBJ) -o $(BIN) $(LIBS)

main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
Jul 26 '15 #5
Abhik
6
this line showing error...
main.o: main.c
$(CC) -c main.c -o main.o $(CFLAGS)
Jul 26 '15 #6
weaknessforcats
9,208 Expert Mod 8TB
All this tells me is that the error is in main.c. Generated makefiles like this one don't fail because of errors in the makefile.

That is, errors in your code are causing this. This also means that you are getting more errors than the one you reported.

What does your main.c look like?
Jul 26 '15 #7
Abhik
6
this is my main function

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[])
{
return 0;
}
Jul 26 '15 #8
weaknessforcats
9,208 Expert Mod 8TB
There are no errors in the code you posted. Is this the exact code you were compiling?
Jul 26 '15 #9
Abhik
6
yeah...while compiling the same program its showing that error...
Jul 27 '15 #10
donbock
2,422 Expert 2GB
Maybe gcc.exe is not accessible with your current PATH.
try typing the offending command at the command prompt:
gcc.exe -c main.c -o main.o
This can't succeed because it doesn't include the CFLAGS, but the nature of the failure will tell you if gcc is running. That command line should succeed if you temporarily comment out the #includes in main.c.
Jul 27 '15 #11
donbock
2,422 Expert 2GB
Maybe gcc.exe is not accessible with your current PATH.
try typing the offending command at the command prompt:
gcc.exe -c main.c -o main.o
This can't succeed because it doesn't include the CFLAGS, but the nature of the failure will tell you if gcc is running. That command line should succeed if you temporarily comment out the #includes in main.c.

Another possibility is that the long list of include paths makes the expanded command line too long for your shell.
Jul 27 '15 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by invincible | last post: by
17 posts views Thread by abdur_rab7 | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.