public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: abetton@rennes.jouve.fr
To: gcc-gnats@gcc.gnu.org
Subject: c++/4225: bad reference in an object file caused by the include method
Date: Tue, 04 Sep 2001 08:26:00 -0000	[thread overview]
Message-ID: <20010904151948.12266.qmail@sourceware.cygnus.com> (raw)

>Number:         4225
>Category:       c++
>Synopsis:       bad reference in an object file caused by the include method
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 04 08:26:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Armand Betton
>Release:        gcc 3.0.1
>Organization:
>Environment:
Reading specs from /home/dsv5/packages/gcc-3.0.1/lib/gcc-lib/sparc-sun-solaris2.
7/3.0.1/specs
Configured with: /tmcenter/navis/ccpkg/data/gcc-3.0.1/configure --prefix=/home/d
sv5/packages/gcc-3.0.1 --enable-languages=c++,java --enable-shared --enable-thre
ads --with-gnu-ld --with-ld=/home/dsv5/packages/binutils-2.11.2/bin/ld --with-gn
u-as --with-as=/home/dsv5/packages/binutils-2.11.2/bin/as
Thread model: posix
gcc version 3.0.1
>Description:
1- An .h file declaring a C++ function

/tmp/foo/foo.h

<<
void foo(int x);
>How-To-Repeat:
See description.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
 >>
 
 2- A C++ source including the .h file and calling the function
 
 /tmp/foo.c
 
 <<
 #include "foo.h"
 
 int main(void)
 {
     foo(0);
 }
 >>
 
 3- First compilation using "-I" option
 
 CPLUS_INCLUDE_PATH=
 export CPLUS_INCLUDE_PATH
 gcc -ggdb -c -I/tmp/foo -o foo.o -x c++ foo.c
 nm -C foo.o
 
 <<
 0000000000000000 a *ABS*
                  U foo(int)
 0000000000000000 ? __FRAME_BEGIN__
                  U __gxx_personality_v0
 0000000000000000 T main
 >>
 
 the "foo" function is referenced as a mangled c++ function reference
 
 4- Second compilation (not using the -I option)
 
 CPLUS_INCLUDE_PATH=/tmp/foo
 export CPLUS_INCLUDE_PATH
 gcc -ggdb -c -o foo.o -x c++ foo.c
 nm -C foo.o
 
 <<
 0000000000000000 a *ABS*
 0000000000000000 ? __FRAME_BEGIN__
                  U __gxx_personality_v0
                  U foo
 0000000000000000 T main
 >>
 
 The "foo" function is now referenced as a "C" (instead of C++) function.
 
 This is a dummy example ; in a real case, the "foo" function is defined in an external library ; the "link" stage cause an "undefined reference foo(int)".
 
 
----gnatsweb-attachment----
Content-Type: application/x-gzip-compressed; name="foo.tgz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foo.tgz"

H4sIAPPulDsAA+3UvW7CMBRAYa/1U1h0gQWug38GniaCVlhqkgoMQkK8OzGtYEOq1ITlfIsHW/Id
fJyb78Vn183XajhiRYITJVJ5511ZnXNVv/7yQUlcOm+Dr2Lsz1vrozIy4Ex3h32ud8aotj6m/ZNz
uRljmtG9p3b9ddh8mEl5BduJ1qnNpqlTOz12aTPTZ/3W70xlttIX/epp8d/yT/+3P2A70B2l/+if
9F/ZR//Bl/7jMtD/GErkpgResj/1kb96IAAAAAAAAAAAAAAAAPzJFes+Gw0AKAAA


             reply	other threads:[~2001-09-04  8:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-04  8:26 abetton [this message]
2001-09-04 15:27 aoliva
2002-11-21 18:56 Wolfgang Bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010904151948.12266.qmail@sourceware.cygnus.com \
    --to=abetton@rennes.jouve.fr \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).