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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abhik
    New Member
    • Jul 2015
    • 6

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

    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..
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Where did you get the makefile?

    Comment

    • Abhik
      New Member
      • Jul 2015
      • 6

      #3
      its installed in that DEV C++ software

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        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?

        Comment

        • Abhik
          New Member
          • Jul 2015
          • 6

          #5
          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)

          Comment

          • Abhik
            New Member
            • Jul 2015
            • 6

            #6
            this line showing error...
            main.o: main.c
            $(CC) -c main.c -o main.o $(CFLAGS)

            Comment

            • weaknessforcats
              Recognized Expert Expert
              • Mar 2007
              • 9214

              #7
              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?

              Comment

              • Abhik
                New Member
                • Jul 2015
                • 6

                #8
                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;
                }

                Comment

                • weaknessforcats
                  Recognized Expert Expert
                  • Mar 2007
                  • 9214

                  #9
                  There are no errors in the code you posted. Is this the exact code you were compiling?

                  Comment

                  • Abhik
                    New Member
                    • Jul 2015
                    • 6

                    #10
                    yeah...while compiling the same program its showing that error...

                    Comment

                    • donbock
                      Recognized Expert Top Contributor
                      • Mar 2008
                      • 2427

                      #11
                      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.

                      Comment

                      • donbock
                        Recognized Expert Top Contributor
                        • Mar 2008
                        • 2427

                        #12
                        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.

                        Comment

                        Working...