gcc problem

After installing 6.1 I have problems compiling my C++ code.
Example code below. Is it a bug of feature which prevents me
from including math.h and stdlib.h in C++ code?
If replacing <math.h> with it works, but I’d rather not do this
for all my source code.
A Unix colleague recommended running “fixincludes” to create inlcude
files compatible with the new OS version, but I cannot find this utility.
Could I be the victim of an partial installation?

Cheers / Tom

#include <math.h>
#include <stdlib.h>

main(int argc, char *arv[])
{
float a=0.0,b,c;

b = cos(a);
c = cos(0.0);
}

compilation:

$ make f
g++ -g -c f.cc -o f.o
In file included from f.cc:1:
/usr/include/math.h:558: cos’ is already declared in this scope
/usr/include/math.h:558: fabs’ is already declared in this scope
/usr/include/math.h:559: sin’ is already declared in this scope
/usr/include/math.h:559: sqrt’ is already declared in this scope
/usr/include/math.h:570: cosf’ is already declared in this scope
/usr/include/math.h:570: fabsf’ is already declared in this scope
/usr/include/math.h:571: sinf’ is already declared in this scope
/usr/include/math.h:571: sqrtf’ is already declared in this scope
/usr/include/math.h:582: cosl’ is already declared in this scope
/usr/include/math.h:582: fabsl’ is already declared in this scope
/usr/include/math.h:583: sinl’ is already declared in this scope
/usr/include/math.h:583: sqrtl’ is already declared in this scope
In file included from f.cc:2:
/usr/include/stdlib.h:239: abort’ is already declared in this scope
/usr/include/stdlib.h:240: exit’ is already declared in this scope
/usr/include/stdlib.h:240: labs’ is already declared in this scope
make: *** [f.o] Error 1
$

Edit /usr/lib/gcc-lib/ntox86/2.95.2/specs

*cc1plus:
%(cc1plus_spec) -fhonor-std -fno-builtin

“Tomas Högström” <tomas@scandicraft.se> wrote in message
news:3B6FF234.BAD5B000@scandicraft.se

After installing 6.1 I have problems compiling my C++ code.
Example code below. Is it a bug of feature which prevents me
from including math.h and stdlib.h in C++ code?
If replacing <math.h> with it works, but I’d rather not do this
for all my source code.
A Unix colleague recommended running “fixincludes” to create inlcude
files compatible with the new OS version, but I cannot find this utility.
Could I be the victim of an partial installation?

Cheers / Tom

#include <math.h
#include <stdlib.h

main(int argc, char *arv[])
{
float a=0.0,b,c;

b = cos(a);
c = cos(0.0);
}

compilation:

$ make f
g++ -g -c f.cc -o f.o
In file included from f.cc:1:
/usr/include/math.h:558: cos’ is already declared in this scope
/usr/include/math.h:558: fabs’ is already declared in this scope
/usr/include/math.h:559: sin’ is already declared in this scope
/usr/include/math.h:559: sqrt’ is already declared in this scope
/usr/include/math.h:570: cosf’ is already declared in this scope
/usr/include/math.h:570: fabsf’ is already declared in this scope
/usr/include/math.h:571: sinf’ is already declared in this scope
/usr/include/math.h:571: sqrtf’ is already declared in this scope
/usr/include/math.h:582: cosl’ is already declared in this scope
/usr/include/math.h:582: fabsl’ is already declared in this scope
/usr/include/math.h:583: sinl’ is already declared in this scope
/usr/include/math.h:583: sqrtl’ is already declared in this scope
In file included from f.cc:2:
/usr/include/stdlib.h:239: abort’ is already declared in this scope
/usr/include/stdlib.h:240: exit’ is already declared in this scope
/usr/include/stdlib.h:240: labs’ is already declared in this scope
make: *** [f.o] Error 1
$

Thanks, seem to have made things better. Still problems with ostream though:
Cannot do
fout << X;
to ofstream fout (and probably not to an ostream either) when X is an uint64_t;
still overload/ambiguity problems there.

Cheers / Tom

Mario Charest wrote:

Edit /usr/lib/gcc-lib/ntox86/2.95.2/specs

*cc1plus:
%(cc1plus_spec) -fhonor-std -fno-builtin

Well also, instead of calling g++, you might just want to go with qcc, did
what you posted, and I did not even get a warning or nothing.

Regards,

Francois

Tomas Högström <tomas@scandicraft.se> wrote:


Thanks, seem to have made things better. Still problems with ostream though:
Cannot do
fout << X;
to ofstream fout (and probably not to an ostream either) when X is an uint64_t;
still overload/ambiguity problems there.

Cheers / Tom

Mario Charest wrote:

Edit /usr/lib/gcc-lib/ntox86/2.95.2/specs

*cc1plus:
%(cc1plus_spec) -fhonor-std -fno-builtin

A good point, but I switched to g++ when I couldn’t get my code including BLAS
and LAPACK libraries through qcc. I’ll make a new attempt when the current
problem is resolved.
qcc seems not either able to handle a unint64 sent to a ostream.
New program and g++ and qcc compilation output below.
Same error. Or is it a bug in my code?
If removing the problem line, it compiles and links with g++ but fails to link
with qcc (do I miss a library?):

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

Cheers / Tom

f.cc:

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include

using namespace std;

main(int argc, char *argv[])
{
float a=0.0,b,c;
uint64_t x = 0;

ofstream fout(“foo.txt”);

b = cos(a);
c = cos(0.0);
fout << x << endl; // problem line

exit(EXIT_SUCCESS);
}

$ g++ -g -c f.cc -o f.o
f.cc: In function int main(int, char **)’:
f.cc:18: ambiguous overload for std::ofstream & << uint64_t &’
/usr/include/ostream:108: candidates are: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(bool)
/usr/include/ostream:127: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(short int)
/usr/include/ostream:151: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(short unsigned int)
/usr/include/ostream:170: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(int)
/usr/include/ostream:194: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(unsigned int)
/usr/include/ostream:213: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long int)
/usr/include/ostream:232: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long unsigned int)
/usr/include/ostream:291: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(float)
/usr/include/ostream:310: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(double)
/usr/include/ostream:329: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long double)
/usr/include/ostream:517: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<char, std::char_traits

(std::basic_ostream<ch
ar,std::char_traits > &, char)

/usr/include/ostream:598: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, char)

/usr/include/ostream:721: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, signed char)

/usr/include/ostream:733: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, unsigned char)

make: *** [f.o] Error 1

$ qcc -g -c f.cc -o fq.o
f.cc: In function int main(int, char **)’:
f.cc:18: ambiguous overload for std::ofstream & << uint64_t &’
/usr/include/ostream:108: candidates are: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(bool)
/usr/include/ostream:127: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(short int)
/usr/include/ostream:151: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(short unsigned int)
/usr/include/ostream:170: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(int)
/usr/include/ostream:194: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(unsigned int)
/usr/include/ostream:213: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long int)
/usr/include/ostream:232: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long unsigned int)
/usr/include/ostream:291: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(float)
/usr/include/ostream:310: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(double)
/usr/include/ostream:329: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
<<(long double)
/usr/include/ostream:517: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<char, std::char_traits

(std::basic_ostream<ch
ar,std::char_traits > &, char)

/usr/include/ostream:598: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, char)

/usr/include/ostream:721: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, signed char)

/usr/include/ostream:733: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits

(std::basic_ostream<char,std
::char_traits > &, unsigned char)

cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
make: *** [fq.o] Error 1


Tools Mail Account wrote:

Well also, instead of calling g++, you might just want to go with qcc, did
what you posted, and I did not even get a warning or nothing.

Regards,

Francois

Tomas Högström <> tomas@scandicraft.se> > wrote:

Thanks, seem to have made things better. Still problems with ostream though:
Cannot do
fout << X;
to ofstream fout (and probably not to an ostream either) when X is an uint64_t;
still overload/ambiguity problems there.

Cheers / Tom

Mario Charest wrote:

Edit /usr/lib/gcc-lib/ntox86/2.95.2/specs

*cc1plus:
%(cc1plus_spec) -fhonor-std -fno-builtin

Tomas Högström <tomas@scandicraft.se> wrote:

Hello,

A good point, but I switched to g++ when I couldn’t get my code including BLAS
and LAPACK libraries through qcc. I’ll make a new attempt when the current
problem is resolved.
qcc seems not either able to handle a unint64 sent to a ostream.
New program and g++ and qcc compilation output below.
Same error. Or is it a bug in my code?
If removing the problem line, it compiles and links with g++ but fails to link
with qcc (do I miss a library?):

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

It looks like you have to define _LONGLONG and _ULONGLONG.

Cheers / Tom

f.cc:

// insert here:

#define _LONGLONG long long
#define _ULONGLONG unsigned long long

#include <math.h
#include <stdlib.h
#include <stdio.h
#include <inttypes.h
#include <fstream

using namespace std;

main(int argc, char *argv[])
{
float a=0.0,b,c;
uint64_t x = 0;

ofstream fout(“foo.txt”);

b = cos(a);
c = cos(0.0);
fout << x << endl; // problem line

exit(EXIT_SUCCESS);

Best Regards,

Marcin


}

$ g++ -g -c f.cc -o f.o
f.cc: In function int main(int, char **)’:
f.cc:18: ambiguous overload for std::ofstream & << uint64_t &’
/usr/include/ostream:108: candidates are: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(bool)
/usr/include/ostream:127: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(short int)
/usr/include/ostream:151: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(short unsigned int)
/usr/include/ostream:170: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(int)
/usr/include/ostream:194: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(unsigned int)
/usr/include/ostream:213: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long int)
/usr/include/ostream:232: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long unsigned int)
/usr/include/ostream:291: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(float)
/usr/include/ostream:310: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(double)
/usr/include/ostream:329: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long double)
/usr/include/ostream:517: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<char, std::char_traits<char
(std::basic_ostream<ch
ar,std::char_traits > &, char)
/usr/include/ostream:598: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, char)
/usr/include/ostream:721: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, signed char)
/usr/include/ostream:733: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, unsigned char)
make: *** [f.o] Error 1

$ qcc -g -c f.cc -o fq.o
f.cc: In function int main(int, char **)’:
f.cc:18: ambiguous overload for std::ofstream & << uint64_t &’
/usr/include/ostream:108: candidates are: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(bool)
/usr/include/ostream:127: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(short int)
/usr/include/ostream:151: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(short unsigned int)
/usr/include/ostream:170: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(int)
/usr/include/ostream:194: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(unsigned int)
/usr/include/ostream:213: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long int)
/usr/include/ostream:232: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long unsigned int)
/usr/include/ostream:291: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(float)
/usr/include/ostream:310: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(double)
/usr/include/ostream:329: class
std::basic_ostream<char,std::char_tr
aits > & std::basic_ostream<char,std::char_traits >::operator
(long double)
/usr/include/ostream:517: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<char, std::char_traits<char
(std::basic_ostream<ch
ar,std::char_traits > &, char)
/usr/include/ostream:598: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, char)
/usr/include/ostream:721: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, signed char)
/usr/include/ostream:733: class
std::basic_ostream<char,std::char_tr
aits > & std::operator <<<std::char_traits<char
(std::basic_ostream<char,std
::char_traits > &, unsigned char)
cc: /usr/lib/gcc-lib/ntox86/2.95.2/cc1plus error 33
make: *** [fq.o] Error 1



Tools Mail Account wrote:

Well also, instead of calling g++, you might just want to go with qcc, did
what you posted, and I did not even get a warning or nothing.

Regards,

Francois

Tomas Högström <> tomas@scandicraft.se> > wrote:

Thanks, seem to have made things better. Still problems with ostream though:
Cannot do
fout << X;
to ofstream fout (and probably not to an ostream either) when X is an uint64_t;
still overload/ambiguity problems there.

Cheers / Tom

Mario Charest wrote:

Edit /usr/lib/gcc-lib/ntox86/2.95.2/specs

*cc1plus:
%(cc1plus_spec) -fhonor-std -fno-builtin

Thanks, works fine. Now there’s only some annoying warning messages
at linking time:

/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libc.so.2

Tom

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

It looks like you have to define _LONGLONG and _ULONGLONG.

Tomas Högström <tomas@scandicraft.se> wrote:

Thanks, works fine. Now there’s only some annoying warning messages
at linking time:

Hello Tom,

I can’t get this warning, I’ve tried different warnings levels, can you
post the qcc option line that you’ve used?. I think it is because your
program was linked with libm.so.2 lib, and libstdc++ was linked with
libm.so.1.

Best Regards,

Marcin

/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++…so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++…so,
may conflict with libc.so.2

Tom

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

It looks like you have to define _LONGLONG and _ULONGLONG.

$ make filtermklq
qcc -g -W1 -lang-c++ -o filtermkl filtermkl.o /usr/local/lib/expokit.o -lm -lstdc++
/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libc.so.2

Tom

Tools Mail Account wrote:

Tomas Högström <> tomas@scandicraft.se> > wrote:
Thanks, works fine. Now there’s only some annoying warning messages
at linking time:

Hello Tom,

I can’t get this warning, I’ve tried different warnings levels, can you
post the qcc option line that you’ve used?. I think it is because your
program was linked with libm.so.2 lib, and libstdc++ was linked with
libm.so.1.

Best Regards,

Marcin

/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libc.so.2

Tom

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

It looks like you have to define _LONGLONG and _ULONGLONG.

Use -lang-c++ instead of -lstdc++. stdc++ is the old GNU lib which gives you
the conflicts, -lang-c++ will link to the new Dinkum c++ lib (libcpp.so)
Markus

“Tomas Högström” <tomas@scandicraft.se> wrote in message
news:3B7A2E30.3AA01A6F@scandicraft.se

Thanks, works fine. Now there’s only some annoying warning messages
at linking time:

/usr/ntox86/bin/ld: warning: libm.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conflict with libc.so.2

Tom

$ qcc -g -W1 -o fq fq.o -lm
fq.o:f.cc:21: undefined reference to std::terminate(void)’
fq.o:f.cc:8: undefined reference to std::ios_base::Init::Init(void)’
…more undefined refererence follows…

It looks like you have to define _LONGLONG and _ULONGLONG.

Didn’t work for me (see below). Seems like I need both -lang-c++ and -lstdc++
to get the code through the compiler. Is there perhaps an alternative std lib?

Tom

Markus Loffler wrote:

Use -lang-c++ instead of -lstdc++. stdc++ is the old GNU lib which gives you
the conflicts, -lang-c++ will link to the new Dinkum c++ lib (libcpp.so)
Markus

$ make ilaenvtestq
qcc -g -W1 \ -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a /usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a /usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lang-c++

/usr/local/lib/libI77.a(fmt.o): In function op_gen’:
fmt.o(.text+0xb6): undefined reference to __iob’
/usr/local/lib/libI77.a(fmt.o): In function do_fio’:
fmt.o(.text+0xc6a): undefined reference to __iob’
/usr/local/lib/libI77.a(lread.o): In function t_getc’:
lread.o(.text+0x1e): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(open.o): In function f__putbuf’:
open.o(.text+0x192): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function xrd_SL’:
rsfe.o(.text+0x16): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function x_getc’:
rsfe.o(.text+0xce): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(err.o): In function f__fatal’:
err.o(.text+0xea): undefined reference to __iob’
err.o(.text+0x10b): undefined reference to __iob’
err.o(.text+0x13c): undefined reference to __iob’
err.o(.text+0x18c): undefined reference to __iob’
err.o(.text+0x1bf): undefined reference to __iob’
/usr/local/lib/libI77.a(err.o)(.text+0x1d9): more undefined references to
__iob’ follow
/usr/local/lib/libF77.a(s_stop.o): In function s_stop’:
s_stop.o(.text+0x3e): undefined reference to _multi_threaded’
s_stop.o(.text+0x46): undefined reference to __iob’
s_stop.o(.text+0x52): undefined reference to __iob’
s_stop.o(.text+0x58): undefined reference to __iob’
s_stop.o(.text+0x6c): undefined reference to __iob’
s_stop.o(.text+0x85): undefined reference to __iob’
/usr/local/lib/libF77.a(s_stop.o)(.text+0x9c): more undefined references to
__iob’ follow
cc: /usr/ntox86/bin/ld error 1
make: *** [ilaenvtestq] Error 1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$ qcc -g -W1 -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a /usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a /usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lstdc++

/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libc.so.2
ilaenvtest.o: In function main’:
ilaenvtest.cc:52: undefined reference to std::terminate(void)’
ilaenvtest.o: In function __static_initialization_and_destruction_0’:
ilaenvtest.cc:8: undefined reference to std::ios_base::Init::Init(void)’
ilaenvtest.cc:25: undefined reference to std::_Winit::_Winit(void)’
ilaenvtest.cc:8: undefined reference to std::ios_base::Init::Init(void)’
ilaenvtest.cc:125: undefined reference to std::ios_base::Init::~Init(void)’
ilaenvtest.cc:125: undefined reference to std::_Winit::~_Winit(void)’
ilaenvtest.cc:125: undefined reference to std::ios_base::Init::~Init(void)’
…(large amount of more error messages) …

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$ make ilaenvtestq
qcc -g -W1 -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a /usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a /usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lang-c++ -lstdc++
/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by /x86/usr/lib/libstdc++.so,
may conf lict with libc.so.2
$

Hi,

I solved a similar problem by compiling & linking C++ code with “QCC” and C
code with “qcc” (analogous to g++ & gcc, respectively). This automatically
specifies the correct libraries.

YMMV,

Rony

“Tomas Högström” <tomas@scandicraft.se> wrote in message
news:3B7A8E7B.ED987C27@scandicraft.se

Didn’t work for me (see below). Seems like I need both -lang-c++
and -lstdc++
to get the code through the compiler. Is there perhaps an alternative std
lib?

Tom

Markus Loffler wrote:

Use -lang-c++ instead of -lstdc++. stdc++ is the old GNU lib which gives
you
the conflicts, -lang-c++ will link to the new Dinkum c++ lib (libcpp.so)
Markus

$ make ilaenvtestq
qcc -g -W1 \ -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a
/usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a
/usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lang-c++

/usr/local/lib/libI77.a(fmt.o): In function op_gen’:
fmt.o(.text+0xb6): undefined reference to __iob’
/usr/local/lib/libI77.a(fmt.o): In function do_fio’:
fmt.o(.text+0xc6a): undefined reference to __iob’
/usr/local/lib/libI77.a(lread.o): In function t_getc’:
lread.o(.text+0x1e): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(open.o): In function f__putbuf’:
open.o(.text+0x192): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function xrd_SL’:
rsfe.o(.text+0x16): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function x_getc’:
rsfe.o(.text+0xce): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(err.o): In function f__fatal’:
err.o(.text+0xea): undefined reference to __iob’
err.o(.text+0x10b): undefined reference to __iob’
err.o(.text+0x13c): undefined reference to __iob’
err.o(.text+0x18c): undefined reference to __iob’
err.o(.text+0x1bf): undefined reference to __iob’
/usr/local/lib/libI77.a(err.o)(.text+0x1d9): more undefined references to
__iob’ follow
/usr/local/lib/libF77.a(s_stop.o): In function s_stop’:
s_stop.o(.text+0x3e): undefined reference to _multi_threaded’
s_stop.o(.text+0x46): undefined reference to __iob’
s_stop.o(.text+0x52): undefined reference to __iob’
s_stop.o(.text+0x58): undefined reference to __iob’
s_stop.o(.text+0x6c): undefined reference to __iob’
s_stop.o(.text+0x85): undefined reference to __iob’
/usr/local/lib/libF77.a(s_stop.o)(.text+0x9c): more undefined references
to
__iob’ follow
cc: /usr/ntox86/bin/ld error 1
make: *** [ilaenvtestq] Error 1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$ qcc -g -W1 -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a
/usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a
/usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lstdc++

/usr/ntox86/bin/ld: warning: libm.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conflict with libc.so.2
ilaenvtest.o: In function main’:
ilaenvtest.cc:52: undefined reference to std::terminate(void)’
ilaenvtest.o: In function __static_initialization_and_destruction_0’:
ilaenvtest.cc:8: undefined reference to std::ios_base::Init::Init(void)’
ilaenvtest.cc:25: undefined reference to std::_Winit::_Winit(void)’
ilaenvtest.cc:8: undefined reference to std::ios_base::Init::Init(void)’
ilaenvtest.cc:125: undefined reference to
std::ios_base::Init::~Init(void)’
ilaenvtest.cc:125: undefined reference to std::_Winit::~_Winit(void)’
ilaenvtest.cc:125: undefined reference to
std::ios_base::Init::~Init(void)’
…(large amount of more error messages) …

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++

$ make ilaenvtestq
qcc -g -W1 -o ilaenvtest ilaenvtest.o
/usr/local/lib/expokit.o /usr/local/lib/mkl_qnx6.1_liblapack++.a
/usr/local/lib/mkl_qnx6.1_libblas++.a
/usr/local/lib/mkl_qnx6.1_liblamatrix++.a
/usr/local/lib/libmkl32_lapack.a /usr/local/lib/libmkl32_p3.a
/usr/local/lib/libI77.a
/usr/local/lib/libF77.a /usr/local/lib/randlib.a -lm -lang-c++ -lstdc++
/usr/ntox86/bin/ld: warning: libm.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conflict with libm.so.2
/usr/ntox86/bin/ld: warning: libc.so.1, needed by
/x86/usr/lib/libstdc++.so,
may conf lict with libc.so.2
$

Hi,

using QCC made it possible to not include “-lang-c++”, i.e. compiling with
“-lang-c++ -lstdc++” and “-lstdc++” both works, although still giving the
same “/usr/ntox86/bin/ld: warning: libm.so.1, needed by /x86/usr/lib/libstdc++.so,
may conflict with libm.so.2” warnings.
I still need -lstdc++ to not get undefiend references to “__iob” and “_multi_threaded”.

Perhaps not important, but I use a patched gcc according to the second message
in this thread.

Cheers / Tom

Rony Shapiro wrote:

Hi,

I solved a similar problem by compiling & linking C++ code with “QCC” and C
code with “qcc” (analogous to g++ & gcc, respectively). This automatically
specifies the correct libraries.

YMMV,

Rony

These undefined references indicate that your libI77.a was compiled
on a 6.0 system. This is incompatible when linking against 6.1
programs, so you will need to recompile your fortran(?) libs.

You definately shouldn’t be linking against libstdc++, that is also 6.0 only.

/usr/local/lib/libI77.a(fmt.o): In function op_gen’:
fmt.o(.text+0xb6): undefined reference to __iob’
/usr/local/lib/libI77.a(fmt.o): In function do_fio’:
fmt.o(.text+0xc6a): undefined reference to __iob’
/usr/local/lib/libI77.a(lread.o): In function t_getc’:
lread.o(.text+0x1e): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(open.o): In function f__putbuf’:
open.o(.text+0x192): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function xrd_SL’:
rsfe.o(.text+0x16): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(rsfe.o): In function x_getc’:
rsfe.o(.text+0xce): undefined reference to _multi_threaded’
/usr/local/lib/libI77.a(err.o): In function f__fatal’:
err.o(.text+0xea): undefined reference to __iob’
err.o(.text+0x10b): undefined reference to __iob’
err.o(.text+0x13c): undefined reference to __iob’
err.o(.text+0x18c): undefined reference to __iob’
err.o(.text+0x1bf): undefined reference to __iob’
/usr/local/lib/libI77.a(err.o)(.text+0x1d9): more undefined references to
__iob’ follow
/usr/local/lib/libF77.a(s_stop.o): In function s_stop’:
s_stop.o(.text+0x3e): undefined reference to _multi_threaded’
s_stop.o(.text+0x46): undefined reference to __iob’
s_stop.o(.text+0x52): undefined reference to __iob’
s_stop.o(.text+0x58): undefined reference to __iob’
s_stop.o(.text+0x6c): undefined reference to __iob’
s_stop.o(.text+0x85): undefined reference to __iob’
/usr/local/lib/libF77.a(s_stop.o)(.text+0x9c): more undefined references to
__iob’ follow
cc: /usr/ntox86/bin/ld error 1
make: *** [ilaenvtestq] Error 1


cburgess@qnx.com

Thanks, forgot to recompile that lib.
Now my code compiles cleanily without libstdc++.
No, it’s not Fortran libs, just Fortran to C wrapper C libs.
Fortran libs I still have to compile under Linux.

Tom

Colin Burgess wrote:

These undefined references indicate that your libI77.a was compiled
on a 6.0 system. This is incompatible when linking against 6.1
programs, so you will need to recompile your fortran(?) libs.

You definately shouldn’t be linking against libstdc++, that is also 6.0 only.