[dpdk-dev] Changes to makefiles to allow building apps using g++

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Jan 14 12:29:27 CET 2014

Hello Dan,

13/01/2014 23:45, Dan Kan:
> I made changes to makefiles to at least allow app development to be in done
> C++. I'm wondering if the community is interested in getting these changes
> as a patch.

If you need it, it's an excellent reason to integrate it.
Moreover we can guess that you're not alone to have this need.

> The dpdk library must still be compiled using gcc. However, the
> applications can be compiled using g++ by setting CC=g++, e.g. "make
> CC=g++". With g++, non-trivial designated initializers will no longer be
> allowed among others. As a result, most sample apps cannot be compiled
> using g++ without modifications; hello world app works with g++. You will
> also need to specify your c++ file extension if it's not named cpp, e.g.
> make CC=g++ CXX-suffix=cc. The behavior for gcc or icc compilation remains
> unmodified. Anyway, let me know if it's worthwhile to submit a patch.

I think that it should be documented.
What about a file doc/build-app.rst ?
You could start documenting how it is different for C++.

> +ifeq ($(CC), $(CROSS)g++)
> +WERROR_FLAGS := -W -Wall -Werror
> +WERROR_FLAGS += -Wmissing-declarations -Wpointer-arith
> +WERROR_FLAGS += -Wcast-align -Wcast-qual
> +else
>  WERROR_FLAGS := -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
>  WERROR_FLAGS += -Wmissing-declarations -Wold-style-definition
> -Wpointer-arith
>  WERROR_FLAGS += -Wcast-align -Wnested-externs -Wcast-qual
> +endif
>  WERROR_FLAGS += -Wformat-nonliteral -Wformat-security

Could you factorize the common flags, please ?

Thank you

More information about the dev mailing list