how to invoke c++ compiler

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

Hello all,
I had been using 'C' compiler for some time. I now intend using C++. How do I invoke the C++ compiler? Do I need to make changes to the Make file?

Thank you.

Parthasaradhi Nayani

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

Naming your file ending in one of the recognized C++ suffixes (.C,
.cc, .cxx) ought to be sufficient.

Alternatively, call the compiler as avr-g++.

Sorry, the current Makefile has a bug where it will delete your
original C++ code file upon `make clean', otherwise it's already
basically prepared for C++.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

dl8dtl wrote:
Sorry, the current Makefile has a bug where it will delete your original C++ code file upon `make clean', otherwise it's already
basically prepared for C++.

Really? Where's the bug?

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

> Really? Where's the bug?

OBJ = $(SRC:.c=.o) $(ASRC:.S=.o)
^^

This will only derive a .o file for each .c file, but will copy over
file names ending e. g. in .cxx verbatim into the OBJ macro. Upon
`make delete', it'll happily delete'em... :-o

The workaround for GNU make to not delete them is not very hard, while
a workaround for automatically derive .o files from whatever input
file name suffix has been given is already a bit harder. (The proper
fix for my "Unix" (aka. generic make dialect) version of Mfile is even
more difficult, alas.)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.