make: *** No rule to make target 'agenda.cpp', needed by 'agenda'. Stop. #Making Makefile





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a C++ project with this file structure:



enter image description here



include files:



enter image description here



src files:



enter image description here
In order to compile it and run I'm trying to create simple Makefile. After going through some tutorials, that what i got so far:



vpath %.hpp include
vpath %.cpp src
agenda: agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o
g++ agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o -o agenda

User.o:User.hpp User.cpp
g++ -c -std=c++11 User.cpp

Date.o:Date.hpp Date.cpp
g++ -c -std=c++11 Date.cpp

Meeting.o:Meeting.hpp Meeting.cpp
g++ -c -std=c++11 Meeting.cpp

Storage.o:Storage.hpp Storage.cpp
g++ -c -std=c++11 Storage.cpp

AgendaService.o:AgendaService.hpp AgendaService.cpp
g++ -c -std=c++11 AgendaService.cpp

AgendaUI.o:AgendaUI.hpp AgendaUI.cpp
g++ -c -std=c++11 AgendaUI.cpp

clean:
rm User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o


And by the way, the main function here is agenda.cpp file. So by executing the make command I'm getting this error:



make: *** No rule to make target 'agenda.cpp', needed by 'agenda'.  Stop.  


My guess is it can't find the path to agenda.cpp otherwise it wouldn't ask to make a rule. Anyway not sure, hope someone could explain.
EDIT.0:

I have edited makefile by adding vpath, but still get the error(new):



g++ -c -std=c++11 User.cpp
g++: error: User.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
make: *** [makefile:9: User.o] Error 1


Seems like this time it found agenda.cpp and User.hpp but can't find User.cpp. Really would appreciate any clue, was working on it for a long time.



EDIT.1:



#VPATH = src:include
#CPPFLAGS = -I include
#vpath %.hpp include
#vpath %.cpp src

bin/agenda: build/User.o build/Date.o build/Meeting.o build/Storage.o build/AgendaService.o build/AgendaUI.o
@mkdir -p bin
g++ -std=c++11 -w -I./include $^ -o $@

build/%.o: src/%.cpp
@mkdir -p build
g++ -std=c++11 -w -I./include -c -o $@ $<

clean:
@rm -rf build
@rm -rf bin


After spending some time on my Makefile, that is the final answer,it compiles fine all *.cpp files, stores obj file in build folder,no problem,except agenda.cpp(main-file),i didn't get my executable file. But got this error:



/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [makefile:8: bin/agenda] Error 1


How Could i fix this?










share|improve this question




















  • 2





    Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

    – Some programmer dude
    Nov 23 '18 at 11:37













  • You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

    – casper
    Nov 23 '18 at 11:42













  • Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

    – casper
    Nov 23 '18 at 11:46











  • You could also use vpath %.hpp src and vpath %.cpp src

    – Botje
    Nov 23 '18 at 11:56






  • 1





    vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

    – Goswin von Brederlow
    Nov 23 '18 at 15:29


















0















I have a C++ project with this file structure:



enter image description here



include files:



enter image description here



src files:



enter image description here
In order to compile it and run I'm trying to create simple Makefile. After going through some tutorials, that what i got so far:



vpath %.hpp include
vpath %.cpp src
agenda: agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o
g++ agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o -o agenda

User.o:User.hpp User.cpp
g++ -c -std=c++11 User.cpp

Date.o:Date.hpp Date.cpp
g++ -c -std=c++11 Date.cpp

Meeting.o:Meeting.hpp Meeting.cpp
g++ -c -std=c++11 Meeting.cpp

Storage.o:Storage.hpp Storage.cpp
g++ -c -std=c++11 Storage.cpp

AgendaService.o:AgendaService.hpp AgendaService.cpp
g++ -c -std=c++11 AgendaService.cpp

AgendaUI.o:AgendaUI.hpp AgendaUI.cpp
g++ -c -std=c++11 AgendaUI.cpp

clean:
rm User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o


And by the way, the main function here is agenda.cpp file. So by executing the make command I'm getting this error:



make: *** No rule to make target 'agenda.cpp', needed by 'agenda'.  Stop.  


My guess is it can't find the path to agenda.cpp otherwise it wouldn't ask to make a rule. Anyway not sure, hope someone could explain.
EDIT.0:

I have edited makefile by adding vpath, but still get the error(new):



g++ -c -std=c++11 User.cpp
g++: error: User.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
make: *** [makefile:9: User.o] Error 1


Seems like this time it found agenda.cpp and User.hpp but can't find User.cpp. Really would appreciate any clue, was working on it for a long time.



EDIT.1:



#VPATH = src:include
#CPPFLAGS = -I include
#vpath %.hpp include
#vpath %.cpp src

bin/agenda: build/User.o build/Date.o build/Meeting.o build/Storage.o build/AgendaService.o build/AgendaUI.o
@mkdir -p bin
g++ -std=c++11 -w -I./include $^ -o $@

build/%.o: src/%.cpp
@mkdir -p build
g++ -std=c++11 -w -I./include -c -o $@ $<

clean:
@rm -rf build
@rm -rf bin


After spending some time on my Makefile, that is the final answer,it compiles fine all *.cpp files, stores obj file in build folder,no problem,except agenda.cpp(main-file),i didn't get my executable file. But got this error:



/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [makefile:8: bin/agenda] Error 1


How Could i fix this?










share|improve this question




















  • 2





    Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

    – Some programmer dude
    Nov 23 '18 at 11:37













  • You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

    – casper
    Nov 23 '18 at 11:42













  • Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

    – casper
    Nov 23 '18 at 11:46











  • You could also use vpath %.hpp src and vpath %.cpp src

    – Botje
    Nov 23 '18 at 11:56






  • 1





    vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

    – Goswin von Brederlow
    Nov 23 '18 at 15:29














0












0








0








I have a C++ project with this file structure:



enter image description here



include files:



enter image description here



src files:



enter image description here
In order to compile it and run I'm trying to create simple Makefile. After going through some tutorials, that what i got so far:



vpath %.hpp include
vpath %.cpp src
agenda: agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o
g++ agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o -o agenda

User.o:User.hpp User.cpp
g++ -c -std=c++11 User.cpp

Date.o:Date.hpp Date.cpp
g++ -c -std=c++11 Date.cpp

Meeting.o:Meeting.hpp Meeting.cpp
g++ -c -std=c++11 Meeting.cpp

Storage.o:Storage.hpp Storage.cpp
g++ -c -std=c++11 Storage.cpp

AgendaService.o:AgendaService.hpp AgendaService.cpp
g++ -c -std=c++11 AgendaService.cpp

AgendaUI.o:AgendaUI.hpp AgendaUI.cpp
g++ -c -std=c++11 AgendaUI.cpp

clean:
rm User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o


And by the way, the main function here is agenda.cpp file. So by executing the make command I'm getting this error:



make: *** No rule to make target 'agenda.cpp', needed by 'agenda'.  Stop.  


My guess is it can't find the path to agenda.cpp otherwise it wouldn't ask to make a rule. Anyway not sure, hope someone could explain.
EDIT.0:

I have edited makefile by adding vpath, but still get the error(new):



g++ -c -std=c++11 User.cpp
g++: error: User.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
make: *** [makefile:9: User.o] Error 1


Seems like this time it found agenda.cpp and User.hpp but can't find User.cpp. Really would appreciate any clue, was working on it for a long time.



EDIT.1:



#VPATH = src:include
#CPPFLAGS = -I include
#vpath %.hpp include
#vpath %.cpp src

bin/agenda: build/User.o build/Date.o build/Meeting.o build/Storage.o build/AgendaService.o build/AgendaUI.o
@mkdir -p bin
g++ -std=c++11 -w -I./include $^ -o $@

build/%.o: src/%.cpp
@mkdir -p build
g++ -std=c++11 -w -I./include -c -o $@ $<

clean:
@rm -rf build
@rm -rf bin


After spending some time on my Makefile, that is the final answer,it compiles fine all *.cpp files, stores obj file in build folder,no problem,except agenda.cpp(main-file),i didn't get my executable file. But got this error:



/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [makefile:8: bin/agenda] Error 1


How Could i fix this?










share|improve this question
















I have a C++ project with this file structure:



enter image description here



include files:



enter image description here



src files:



enter image description here
In order to compile it and run I'm trying to create simple Makefile. After going through some tutorials, that what i got so far:



vpath %.hpp include
vpath %.cpp src
agenda: agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o
g++ agenda.cpp User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o -o agenda

User.o:User.hpp User.cpp
g++ -c -std=c++11 User.cpp

Date.o:Date.hpp Date.cpp
g++ -c -std=c++11 Date.cpp

Meeting.o:Meeting.hpp Meeting.cpp
g++ -c -std=c++11 Meeting.cpp

Storage.o:Storage.hpp Storage.cpp
g++ -c -std=c++11 Storage.cpp

AgendaService.o:AgendaService.hpp AgendaService.cpp
g++ -c -std=c++11 AgendaService.cpp

AgendaUI.o:AgendaUI.hpp AgendaUI.cpp
g++ -c -std=c++11 AgendaUI.cpp

clean:
rm User.o Date.o Meeting.o Storage.o AgendaService.o AgendaUI.o


And by the way, the main function here is agenda.cpp file. So by executing the make command I'm getting this error:



make: *** No rule to make target 'agenda.cpp', needed by 'agenda'.  Stop.  


My guess is it can't find the path to agenda.cpp otherwise it wouldn't ask to make a rule. Anyway not sure, hope someone could explain.
EDIT.0:

I have edited makefile by adding vpath, but still get the error(new):



g++ -c -std=c++11 User.cpp
g++: error: User.cpp: No such file or directory
g++: fatal error: no input files
compilation terminated.
make: *** [makefile:9: User.o] Error 1


Seems like this time it found agenda.cpp and User.hpp but can't find User.cpp. Really would appreciate any clue, was working on it for a long time.



EDIT.1:



#VPATH = src:include
#CPPFLAGS = -I include
#vpath %.hpp include
#vpath %.cpp src

bin/agenda: build/User.o build/Date.o build/Meeting.o build/Storage.o build/AgendaService.o build/AgendaUI.o
@mkdir -p bin
g++ -std=c++11 -w -I./include $^ -o $@

build/%.o: src/%.cpp
@mkdir -p build
g++ -std=c++11 -w -I./include -c -o $@ $<

clean:
@rm -rf build
@rm -rf bin


After spending some time on my Makefile, that is the final answer,it compiles fine all *.cpp files, stores obj file in build folder,no problem,except agenda.cpp(main-file),i didn't get my executable file. But got this error:



/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make: *** [makefile:8: bin/agenda] Error 1


How Could i fix this?







c++ makefile






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 1:14







casper

















asked Nov 23 '18 at 11:27









caspercasper

136




136








  • 2





    Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

    – Some programmer dude
    Nov 23 '18 at 11:37













  • You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

    – casper
    Nov 23 '18 at 11:42













  • Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

    – casper
    Nov 23 '18 at 11:46











  • You could also use vpath %.hpp src and vpath %.cpp src

    – Botje
    Nov 23 '18 at 11:56






  • 1





    vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

    – Goswin von Brederlow
    Nov 23 '18 at 15:29














  • 2





    Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

    – Some programmer dude
    Nov 23 '18 at 11:37













  • You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

    – casper
    Nov 23 '18 at 11:42













  • Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

    – casper
    Nov 23 '18 at 11:46











  • You could also use vpath %.hpp src and vpath %.cpp src

    – Botje
    Nov 23 '18 at 11:56






  • 1





    vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

    – Goswin von Brederlow
    Nov 23 '18 at 15:29








2




2





Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

– Some programmer dude
Nov 23 '18 at 11:37







Remember that paths are relative. There is no agenda.cpp file in the same directory as makefile. There is on the other hand a src/agenda.cpp file. The same problem with all your files. I think you need to spend a little more time with the make documentation. And when you do that I also recommend you learn more about implicit rules, which means you don't have to list the commands to build all object files.

– Some programmer dude
Nov 23 '18 at 11:37















You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

– casper
Nov 23 '18 at 11:42







You mean like wherever makefile is, it is a starting point ? and before each .cpp and .hpp files I should add the path like src/file_name.cpp ?@Someprogrammerdude

– casper
Nov 23 '18 at 11:42















Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

– casper
Nov 23 '18 at 11:46





Sure, just the file structure is the requirement for this assignment idk @Someprogrammerdude

– casper
Nov 23 '18 at 11:46













You could also use vpath %.hpp src and vpath %.cpp src

– Botje
Nov 23 '18 at 11:56





You could also use vpath %.hpp src and vpath %.cpp src

– Botje
Nov 23 '18 at 11:56




1




1





vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

– Goswin von Brederlow
Nov 23 '18 at 15:29





vpath is an advanced Makefile use and often done wrong, don't start with that. For the header files pass "-I include" to g++ and for the cpp files use the full path, e.g. src/User.cpp. You should also make an agenda.o and add a separat linker stage. Once that works look into pattern rules: %.o: %.cpp for example.

– Goswin von Brederlow
Nov 23 '18 at 15:29












1 Answer
1






active

oldest

votes


















0














Alright i made this Makefile and it compiles and runs just fine, just post it here if someone needs that as a reference.

The study path that i used is:
GNU tutorials
(.text+0x20): undefined reference to `main' and undefined reference to function
C Linking Error: undefined reference to 'main'



CC := g++
FLAGS := -std=c++11 -w
BIN_DIR := bin
INC_DIR := include
SRC_DIR := src
INCLUDE := -I./$(INC_DIR)
BUILD_DIR := build

$(BIN_DIR)/agenda: $(BUILD_DIR)/User.o $(BUILD_DIR)/Date.o $(BUILD_DIR)/Meeting.o $(BUILD_DIR)/Storage.o $(BUILD_DIR)/AgendaService.o $(BUILD_DIR)/AgendaUI.o $(BUILD_DIR)/agenda.o
@mkdir -p $(BIN_DIR)
$(CC) $(FLAGS) $(INCLUDE) $^ -o $@

$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(BUILD_DIR)
$(CC) $(FLAGS) $(INCLUDE) -c -o $@ $<

clean:
@rm -rf build
@rm -rf bin





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445850%2fmake-no-rule-to-make-target-agenda-cpp-needed-by-agenda-stop-making%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Alright i made this Makefile and it compiles and runs just fine, just post it here if someone needs that as a reference.

    The study path that i used is:
    GNU tutorials
    (.text+0x20): undefined reference to `main' and undefined reference to function
    C Linking Error: undefined reference to 'main'



    CC := g++
    FLAGS := -std=c++11 -w
    BIN_DIR := bin
    INC_DIR := include
    SRC_DIR := src
    INCLUDE := -I./$(INC_DIR)
    BUILD_DIR := build

    $(BIN_DIR)/agenda: $(BUILD_DIR)/User.o $(BUILD_DIR)/Date.o $(BUILD_DIR)/Meeting.o $(BUILD_DIR)/Storage.o $(BUILD_DIR)/AgendaService.o $(BUILD_DIR)/AgendaUI.o $(BUILD_DIR)/agenda.o
    @mkdir -p $(BIN_DIR)
    $(CC) $(FLAGS) $(INCLUDE) $^ -o $@

    $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
    @mkdir -p $(BUILD_DIR)
    $(CC) $(FLAGS) $(INCLUDE) -c -o $@ $<

    clean:
    @rm -rf build
    @rm -rf bin





    share|improve this answer




























      0














      Alright i made this Makefile and it compiles and runs just fine, just post it here if someone needs that as a reference.

      The study path that i used is:
      GNU tutorials
      (.text+0x20): undefined reference to `main' and undefined reference to function
      C Linking Error: undefined reference to 'main'



      CC := g++
      FLAGS := -std=c++11 -w
      BIN_DIR := bin
      INC_DIR := include
      SRC_DIR := src
      INCLUDE := -I./$(INC_DIR)
      BUILD_DIR := build

      $(BIN_DIR)/agenda: $(BUILD_DIR)/User.o $(BUILD_DIR)/Date.o $(BUILD_DIR)/Meeting.o $(BUILD_DIR)/Storage.o $(BUILD_DIR)/AgendaService.o $(BUILD_DIR)/AgendaUI.o $(BUILD_DIR)/agenda.o
      @mkdir -p $(BIN_DIR)
      $(CC) $(FLAGS) $(INCLUDE) $^ -o $@

      $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
      @mkdir -p $(BUILD_DIR)
      $(CC) $(FLAGS) $(INCLUDE) -c -o $@ $<

      clean:
      @rm -rf build
      @rm -rf bin





      share|improve this answer


























        0












        0








        0







        Alright i made this Makefile and it compiles and runs just fine, just post it here if someone needs that as a reference.

        The study path that i used is:
        GNU tutorials
        (.text+0x20): undefined reference to `main' and undefined reference to function
        C Linking Error: undefined reference to 'main'



        CC := g++
        FLAGS := -std=c++11 -w
        BIN_DIR := bin
        INC_DIR := include
        SRC_DIR := src
        INCLUDE := -I./$(INC_DIR)
        BUILD_DIR := build

        $(BIN_DIR)/agenda: $(BUILD_DIR)/User.o $(BUILD_DIR)/Date.o $(BUILD_DIR)/Meeting.o $(BUILD_DIR)/Storage.o $(BUILD_DIR)/AgendaService.o $(BUILD_DIR)/AgendaUI.o $(BUILD_DIR)/agenda.o
        @mkdir -p $(BIN_DIR)
        $(CC) $(FLAGS) $(INCLUDE) $^ -o $@

        $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
        @mkdir -p $(BUILD_DIR)
        $(CC) $(FLAGS) $(INCLUDE) -c -o $@ $<

        clean:
        @rm -rf build
        @rm -rf bin





        share|improve this answer













        Alright i made this Makefile and it compiles and runs just fine, just post it here if someone needs that as a reference.

        The study path that i used is:
        GNU tutorials
        (.text+0x20): undefined reference to `main' and undefined reference to function
        C Linking Error: undefined reference to 'main'



        CC := g++
        FLAGS := -std=c++11 -w
        BIN_DIR := bin
        INC_DIR := include
        SRC_DIR := src
        INCLUDE := -I./$(INC_DIR)
        BUILD_DIR := build

        $(BIN_DIR)/agenda: $(BUILD_DIR)/User.o $(BUILD_DIR)/Date.o $(BUILD_DIR)/Meeting.o $(BUILD_DIR)/Storage.o $(BUILD_DIR)/AgendaService.o $(BUILD_DIR)/AgendaUI.o $(BUILD_DIR)/agenda.o
        @mkdir -p $(BIN_DIR)
        $(CC) $(FLAGS) $(INCLUDE) $^ -o $@

        $(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
        @mkdir -p $(BUILD_DIR)
        $(CC) $(FLAGS) $(INCLUDE) -c -o $@ $<

        clean:
        @rm -rf build
        @rm -rf bin






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 2:37









        caspercasper

        136




        136
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53445850%2fmake-no-rule-to-make-target-agenda-cpp-needed-by-agenda-stop-making%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy