C++ Makefile

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Right guys, I have the c++ compiling. with this entry in the makefile.

 

$(BUILDDIR)/%.d: %.cpp
    @mkdir -p $(dir $@)
    $(ECHO) DEP $<
    $(Q)$(CC) $(-std=c++20) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -MM $< -MT $(basename $@).o -o $(basename $@).d

 

$(BUILDDIR)/%.o: %.cpp
    @mkdir -p $(dir $@)
    $(ECHO) CC $<
    $(Q)$(CC) $(-std=c++20) $(CFLAGS_CPU) $(CFLAGS_INC) $(CFLAGS_DEFS) -c $< -o $@

 

Has you can see I have only included "-std=c++20".

 

Now I'm having problems including #include <iostream>

and using the std library.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can try adding -n to make; it should just print the build commands rather than try to execute them.

C: i = "told you so";

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This  $(-std=c++20) is wrong. Use plain '-std=c++20' and also check that your compiler supports it ;). E.g. GCC 9 still supports just '-std=c++2a'.