public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ASM + CPP with gcc/gpp
@ 2006-06-08 20:50 revis
  2006-06-09  8:42 ` linking problem with gfortran 4.2.0 Harry Powell
  0 siblings, 1 reply; 4+ messages in thread
From: revis @ 2006-06-08 20:50 UTC (permalink / raw)
  To: gcc-help


Hello all,
I have a problem, I have a class declared within main.cpp and there's the
prototipe of a fuction like MyClass::Function(double); while the
implementation is within an .s file, where I wrote the correct
implementation. The problem is that gpp let me that don't know where to find
the MyClass::Function(double)...

I have in .s file this:

.text
.global _function__8FunctionT0d
....
....
....


When I call it from main I get an 'undefined reference to ...'

Why with simple C function with extern "C" void FF(); the gpp found the
function in the ASM file while with a class function not ?
If there's "the standard" problem, I can't use older versions, because with
older version of gcc.exe and gpp.exe  I get "General Protection Fault" with
my machine, I have an AMD Turion64.

Is there any way to link those files .s and .cpp with the version 2.03 of
DJGPP?

Thanks,
Best regards.

--
View this message in context: http://www.nabble.com/ASM-%2B-CPP-with-gcc-gpp-t1758150.html#a4782372
Sent from the gcc - Help forum at Nabble.com.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linking problem with gfortran 4.2.0
  2006-06-08 20:50 ASM + CPP with gcc/gpp revis
@ 2006-06-09  8:42 ` Harry Powell
  2006-06-09 13:04   ` Tim Prince
  0 siblings, 1 reply; 4+ messages in thread
From: Harry Powell @ 2006-06-09  8:42 UTC (permalink / raw)
  To: gcc-help

Hi

Sorry if this has been answered elsewhere, but I can't find an obvious
reference to it. If this requires an RTFM, could you give me a clue where
in TFM? I found a reference to __gfortran_filename, __gfortran_ioparm, &
__gfortran_line in a discussion on threads but this didn't give an
obvious reason why I was suddenly encountering this error.

Note that the _only_ difference in my two builds is the compiler. All
libraries, flags, etc are identical (so it may just mean that I need to
add another library - but which one?).

I have been trying to build my code on an Intel iMac - with gfortran 4.0.3
compilation & linking goes okay and the executable is usable (though there
are some unwanted features introduced by small bugs in the compiler, which
I believe may have been addressed in newer versions).  With gfortran 4.2.0
I get the following error on linking (in both cases I use the command
"gfortran" for the linking, but this seems to explicitly invoke odcctools
in 4.2.0);

/sw/lib/odcctools/bin/ld: Undefined symbols:
__gfortran_filename
__gfortran_ioparm
__gfortran_line
collect2: ld returned 1 exit status
make[2]: *** [ipmosflm] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2

The gfortran 4.2.0 was installed from the "unstable" branch of fink
(gcc4, 2:4.1.999-20060527).

**************************************************************
Compiler/linker details:

mosflm> /usr/local/bin/gfortran -v
Using built-in specs.
Target: i386-apple-darwin8.5.3
Configured with: ../gcc-4.0.3/configure --enable-languages=fortran
Thread model: posix
gcc version 4.0.3

mosflm> /sw/bin/gfortran -v
Using built-in specs.
Target: i386-apple-darwin8
Configured with: ../gcc-4.2-20060527/configure --prefix=/sw
--prefix=/sw/lib/gcc4 --disable-multilib
--enable-languages=c,c++,fortran,objc,java
--infodir=/sw/lib/gcc4/share/info --with-gmp=/sw --with-included-gettext
--host=i386-apple-darwin8 --with-as=/sw/lib/odcctools/bin/as
--with-ld=/sw/lib/odcctools/bin/ld --with-nm=/sw/lib/odcctools/bin/nm
Thread model: posix
gcc version 4.2.0 20060527 (experimental)

mosflm> /sw/lib/odcctools/bin/ld -v
Apple Computer, Inc. version odcctools-590.36od13
**************************************************************

I tried to do "make bootstrap" with gcc 4.1.1 to try that version, but
the build of the compiler failed (so that's another problem. ho hum...)

Harry
-- 
Dr Harry Powell, MRC Laboratory of Molecular Biology, MRC Centre, Hills
Road, Cambridge, CB2 2QH


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linking problem with gfortran 4.2.0
  2006-06-09  8:42 ` linking problem with gfortran 4.2.0 Harry Powell
@ 2006-06-09 13:04   ` Tim Prince
  2006-06-09 14:34     ` Harry Powell
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Prince @ 2006-06-09 13:04 UTC (permalink / raw)
  To: Harry Powell; +Cc: gcc-help

Harry Powell wrote:
> Hi
> 
> Note that the _only_ difference in my two builds is the compiler. All
> libraries, flags, etc are identical (so it may just mean that I need to
> add another library - but which one?).
> 
> I have been trying to build my code on an Intel iMac - with gfortran 4.0.3
> compilation & linking goes okay and the executable is usable (though there
> are some unwanted features introduced by small bugs in the compiler, which
> I believe may have been addressed in newer versions).  With gfortran 4.2.0
> I get the following error on linking (in both cases I use the command
> "gfortran" for the linking, but this seems to explicitly invoke odcctools
> in 4.2.0);
> 
> /sw/lib/odcctools/bin/ld: Undefined symbols:
> __gfortran_filename
> __gfortran_ioparm
> __gfortran_line
> collect2: ld returned 1 exit status
You must link against the gfortran 4.2 libraries when you compile with 
4.2. In my limited experience, objects involving run time library calls 
don't mix between 4.0, 4.1, and 4.2.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: linking problem with gfortran 4.2.0
  2006-06-09 13:04   ` Tim Prince
@ 2006-06-09 14:34     ` Harry Powell
  0 siblings, 0 replies; 4+ messages in thread
From: Harry Powell @ 2006-06-09 14:34 UTC (permalink / raw)
  To: gcc-help

Hi

(thanks to Tim Prince for this) that seems to be it - rebuilding my local
link libraries appears to have cured the problem.

> You must link against the gfortran 4.2 libraries when you compile with
> 4.2. In my limited experience, objects involving run time library calls
> don't mix between 4.0, 4.1, and 4.2.

> Harry Powell wrote:
> > Hi
> >
> > Note that the _only_ difference in my two builds is the compiler. All
> > libraries, flags, etc are identical (so it may just mean that I need to
> > add another library - but which one?).
> >
> > I have been trying to build my code on an Intel iMac - with gfortran 4.0.3
> > compilation & linking goes okay and the executable is usable (though there
> > are some unwanted features introduced by small bugs in the compiler, which
> > I believe may have been addressed in newer versions).  With gfortran 4.2.0
> > I get the following error on linking (in both cases I use the command
> > "gfortran" for the linking, but this seems to explicitly invoke odcctools
> > in 4.2.0);
> >
> > /sw/lib/odcctools/bin/ld: Undefined symbols:
> > __gfortran_filename
> > __gfortran_ioparm
> > __gfortran_line
> > collect2: ld returned 1 exit status

Harry
-- 
Dr Harry Powell, MRC Laboratory of Molecular Biology, MRC Centre, Hills
Road, Cambridge, CB2 2QH



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-06-09 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-08 20:50 ASM + CPP with gcc/gpp revis
2006-06-09  8:42 ` linking problem with gfortran 4.2.0 Harry Powell
2006-06-09 13:04   ` Tim Prince
2006-06-09 14:34     ` Harry Powell

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).