Skip to content

Using CXX as C++

Using CXX as C++ will make you programming a little relax. C++ has two "+" symbols which let us sometimes annoyed to type with keyboard, cxx only contain latin letters that is awesome! Another candidate is CPP, but CPP maybe mean "C PreProcessor" in some situations. So why not use CXX as C++ Programming Language anywhere?

Step 1:

Copy C++ Compiler program as cxx, on FreeBSD the compiler is clang++ or c++, Copy it as your system:

# cd /usr/bin
# cp clang++ cxx

Other choices:

alias cxx="/usr/bin/clang++"

ln -s clang++ cxx

Step 2:

Using .cxx as your C++ programming language suffix, and compile it:

$ vim prog.cxx
$ cxx prog.cxx -stdlib=libc++ -std=c++17 -lc++experimental -o prog

Step 3:

Using .cxx in your Makefile. Your Makefile maybe already support .cxx c++ suffix, you only need to write .cxx when it needs to write .cpp. However if your Makefile doesn't support .cxx suffix, you can edit the Makefile rule settings:

.SUFFIXES: .cxx .sh .mksh
.cxx.o:
    ${CXX} ${.IMPSRC} -c ${CPPFLAGS} ${CXXFLAGS} -DUSED_CHECK
.mksh:
    cp ${.IMPSRC} ${.TARGET}
    chmod +x ${.TARGET}

You doesn't need to set the .cxx Makefile rule if your Makefile already support it!

.SUFFIXES: .cxx .sh .mksh - add to the suffixes list.

.cxx.o: and the following - setup the build rules for your custom suffixes.

next: CXX - C++ Programming Language

 

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.