std::terminate

I’m compiling some code C++ that used throw. At link time it complains
that std::terminate is not undefined. What am I missing? This was
compiling ok under 6.0.

  • Mario

Mario Charest <mcharest@zinformatic.com> wrote:

Hello,

I’m compiling some code C++ that used throw. At link time it complains
that std::terminate is not undefined. What am I missing? This was
compiling ok under 6.0.

(assuming you have used ‘using namespace std:’ between your headers and main)
can you post a small reproducable test case.

Thanks.

Regards,

Marcin

  • Mario

“Tools Mail Account” <tools@qnx.com> wrote in message
news:9kpeik$k65$2@nntp.qnx.com

Mario Charest <> mcharest@zinformatic.com> > wrote:

Hello,

I’m compiling some code C++ that used throw. At link time it complains
that std::terminate is not undefined. What am I missing? This was
compiling ok under 6.0.

(assuming you have used ‘using namespace std:’ between your headers and
main)
can you post a small reproducable test case.

Ok I will later, I’m on something else at the moment.

Thanks.

Regards,

Marcin

  • Mario

“Tools Mail Account” <tools@qnx.com> wrote in message
news:9kpeik$k65$2@nntp.qnx.com

Mario Charest <> mcharest@zinformatic.com> > wrote:

Hello,

I’m compiling some code C++ that used throw. At link time it complains
that std::terminate is not undefined. What am I missing? This was
compiling ok under 6.0.

(assuming you have used ‘using namespace std:’ between your headers and
main)
can you post a small reproducable test case.

#include <stdio.h>

using namespace std;

void foo() {
printf(“10\n”);
throw 10;
}

int main() {

try {
foo();
}

catch (…){
printf(“problem\n”);
}

}


cc -c test.c
cc test.o -o tryme

I figure it out, the problem is related to the second cc (linking) that
doesn’t
link with the proper library. I add -l cpp and that solved the problem!

Thanks

I understood that c++ should be both compiled and linked with the -lang-c++
option.

“Mario Charest” <mcharest@zinformatic.com> wrote in message
news:9ks23n$2js$1@inn.qnx.com

“Tools Mail Account” <> tools@qnx.com> > wrote in message
news:9kpeik$k65$> 2@nntp.qnx.com> …
Mario Charest <> mcharest@zinformatic.com> > wrote:

Hello,

I’m compiling some code C++ that used throw. At link time it
complains
that std::terminate is not undefined. What am I missing? This was
compiling ok under 6.0.

(assuming you have used ‘using namespace std:’ between your headers and
main)
can you post a small reproducable test case.

#include <stdio.h

using namespace std;

void foo() {
printf(“10\n”);
throw 10;
}

int main() {

try {
foo();
}

catch (…){
printf(“problem\n”);
}

}


cc -c test.c
cc test.o -o tryme

I figure it out, the problem is related to the second cc (linking) that
doesn’t
link with the proper library. I add -l cpp and that solved the problem!

Thanks