Bug #940
closed
ruby/config.h:1:1: warning: "PACKAGE_NAME" redefined
Added by bugmenot (bugmenot bugmenot) almost 16 years ago.
Updated over 13 years ago.
Description
=begin
When including <ruby.h> 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,
from /usr/include/ruby-1.9.0/ruby.h:15,
/usr/include/ruby-1.9.0/x86_64-linux/ruby/config.h:1:1: warning: "PACKAGE_NAME" redefined
Taking the Ubuntu intrepid package:
http://packages.ubuntu.com/intrepid/ruby1.9-dev
=end
- Category set to ext
- Priority changed from Normal to 3
=begin
Can't reproduce.
I suspect you defined PACKAGE_NAME somewhere else.
=end
- Target version set to 1.9.1 RC2
- Status changed from Open to Rejected
=begin
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
=end
=begin
Hi,
In message "Re: [ruby-core:23973] [Bug #940] ruby/config.h:1:1: warning: "PACKAGE_NAME" redefined"
on Tue, 23 Jun 2009 08:24:42 +0900, Luca Bigliardi redmine@ruby-lang.org writes:
|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.
matz.
=end
=begin
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.
Thank you,
luca
=end
- Status changed from Rejected to Assigned
- Assignee set to yugui (Yuki Sonoda)
- Target version changed from 1.9.1 RC2 to 1.9.1
- ruby -v set to ruby 1.9.2dev
=begin
fixed at r23827
=end
- Status changed from Assigned to Closed
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0