ruby/config.h:1:1: warning: "PACKAGE_NAME" redefined
When including in a C program there is this error in the header:
In file included from /usr/include/ruby-1.9.0/ruby/ruby.h:25,
/usr/include/ruby-1.9.0/x86_64-linux/ruby/config.h:1:1: warning: "PACKAGE_NAME" redefined
Taking the Ubuntu intrepid package:
Updated by matz (Yukihiro Matsumoto) almost 12 years ago
|How to reproduce:
|- start a project with autotools (including autoheader)
|- create a C/C++ file including both ruby.h and config.h generated by autotools
I have no idea to fix this issue when including independently
generated header files in single source file. Probably people behind
autotools know how to resolve.
Updated by shammash (Luca Bigliardi) almost 12 years ago
Let me explain you a bit more what's happening:
- Autotools are a widely used, long time existing tool for handling C/C++ projects ( http://en.wikipedia.org/wiki/GNU_build_system )
- If in your project you have to do conditional compilation depending on the features found by the "./configure" script then the way to do it is let autotools define in config.h something like HAVE_FEATURE so in your code you simply do: #ifdef HAVE_FEATURE .... #endif
- If in a C/C++ module you have to deal at the same time with conditional compilation and ruby bindings then you have to include both config.h and ruby.h
- Ruby somewhere defines its own PACKAGE_NAME PACKAGE_STRING PACKAGE_TARNAME PACKAGE_VERSION which are already defined in config.h created by your "./configure".
To me it sounds like the problem comes our from the fact that you're installing your own
config.h and referencing it from an header you provide as an interface.