linker error - simply program

Hi!
I’m trying to compile simple program in a main.cpp file:

#include
using namespace std;
int main(void)
{
cout<<“QNX”<<endl;
return 0;
}
and:
QCC -Vgcc/3.3.1,gcc_ntox86 -c main.cpp -o main.o
(now the object file main.o is created) and
QCC -Vgcc/3.3.1,gcc_ntox86 main.o -o main
and after this command I have some errros:
/*********************************************************/
main.o: In function main': main.o(.text+0x29): undefined reference to std::cout’
main.o: In function __static_initialization_and_destruction_0(int, int)': main.o(.text+0x8c): undefined reference to std::ios_base::Init::Init()’
main.o(.text+0xab): undefined reference to std::ios_base::Init::~Init()' main.o: In function std::ostream::put(char)’:
main.o(.gnu.linkonce.t._ZNSo3putEc+0xb8): undefined reference to
__cxa_begin_ca tch' main.o(.gnu.linkonce.t._ZNSo3putEc+0xe5): undefined reference to __cxa_end_catc
h’
main.o(.gnu.linkonce.t._ZNSo3putEc+0xef): undefined reference to
__cxa_end_catc h' main.o: In function std::basic_ostream<char, std::char_traits >&
std::ope
rator<< <std::char_traits >(std::basic_ostream<char,
std::char_traits<char

&, char const*)’:
main.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0

x280): undefined reference to __cxa_begin_catch' main.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0 x2ad): undefined reference to __cxa_end_catch’
main.o(.gnu.linkonce.t._ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0
x2b7): undefined reference to __cxa_end_catch' main.o: In function std::ostream::sentry::~sentry()’:
main.o(.gnu.linkonce.t._ZNSo6sentryD1Ev+0x8): undefined reference to
std::uncau ght_exception()' main.o: In function std::basic_ios<char, std::char_traits

::clear(std::_
Iosb::_Iostate, bool)’:

main.o(.gnu.linkonce.t.ZNSt9basic_iosIcSt11char_traitsIcEE5clearENSt5_IosbIiE8
IostateEb+0x35): undefined reference to
std::ios_base::clear(std::_Iosb<int>::_ Iostate, bool)' main.o: In function std::locale::~locale()’:
main.o(.gnu.linkonce.t._ZNSt6localeD1Ev+0x58): undefined reference to
__cxa_cal l_unexpected' main.o: In function std::ctype const&
std::use_facet<std::ctype >(s
td::locale const&)’:
main.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0x24):
undefin
ed reference to std::ctype<char>::id' main.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0x3d): undefin ed reference to std::locale::_Getfacet(unsigned) const’
main.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0x7a):
undefin
ed reference to __cxa_allocate_exception' main.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0x9e): undefin ed reference to __cxa_throw’
main.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0xcb):
undefin
ed reference to std::locale::facet::_Register()' main.o: In function std::bad_cast::~bad_cast()’:
main.o(.gnu.linkonce.t._ZNSt8bad_castD1Ev+0x16): undefined reference to
std::ex ception::~exception()' main.o(.gnu.linkonce.t._ZNSt8bad_castD1Ev+0x30): undefined reference to operato
r delete(void*)’
main.o: In function std::locale::id::operator unsigned()': main.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x2c): undefined reference to std::
locale::id::_Id_cnt’
main.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x31): undefined reference to
std:: locale::id::_Id_cnt' main.o: In function std::locale::locale(std::locale const&)’:
main.o(.gnu.linkonce.t.ZNSt6localeC1ERKS+0x4a): undefined reference to
__cxa_ call_unexpected' main.o: In function std::ctype::_Getcat(std::locale::facet
const**)’:
main.o(.gnu.linkonce.t._ZNSt5ctypeIcE7_GetcatEPPKNSt6locale5facetE+0x20):
undefi
ned reference to operator new(unsigned)' main.o(.gnu.linkonce.t._ZNSt5ctypeIcE7_GetcatEPPKNSt6locale5facetE+0x5f): undefi ned reference to operator delete(void*)’
main.o(.gnu.linkonce.r._ZTISt8bad_cast+0x0): undefined reference to
vtable for __cxxabiv1::__si_class_type_info' main.o(.gnu.linkonce.r._ZTISt8bad_cast+0x8): undefined reference to typeinfo fo
r std::exception’
main.o: In function std::exception::exception()': main.o(.gnu.linkonce.t._ZNSt9exceptionC2Ev+0x8): undefined reference to vtable
for std::exception’
main.o: In function std::bad_cast::~bad_cast()': main.o(.gnu.linkonce.t._ZNSt8bad_castD0Ev+0x16): undefined reference to std::ex
ception::~exception()’
main.o(.gnu.linkonce.t._ZNSt8bad_castD0Ev+0x30): undefined reference to
operato r delete(void*)' main.o: In function std::ctype::ctype(short const*, bool,
unsigned)’:
main.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x34): undefined reference
to std ::_Locinfo::_Locinfo(char const*)' main.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x5a): undefined reference to std
::_Locinfo::~_Locinfo()’
main.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x6e): undefined reference
to std ::_Locinfo::~_Locinfo()' main.o: In function std::ctype_base::~ctype_base()’:
main.o(.gnu.linkonce.t._ZNSt10ctype_baseD2Ev+0x30): undefined reference to
oper ator delete(void*)' main.o: In function std::ctype::_Tidy()’:
main.o(.gnu.linkonce.t._ZNSt5ctypeIcE5_TidyEv+0x3e): undefined reference
to ope rator delete[](void*)' main.o: In function std::ctype::~ctype()’:
main.o(.gnu.linkonce.t._ZNSt5ctypeIcED1Ev+0x3e): undefined reference to
operato r delete(void*)' main.o: In function std::ctype::~ctype()’:
main.o(.gnu.linkonce.t._ZNSt5ctypeIcED0Ev+0x3e): undefined reference to
operato r delete(void*)' main.o(.gnu.linkonce.r._ZTISt5ctypeIcE+0x0): undefined reference to vtable for
__cxxabiv1::__si_class_type_info’
main.o: In function std::_Locinfo::_Getctype() const': main.o(.gnu.linkonce.t._ZNKSt8_Locinfo9_GetctypeEv+0x18): undefined reference to _Getctyptab’
main.o: In function std::locale::facet::~facet()': main.o(.gnu.linkonce.t._ZNSt6locale5facetD2Ev+0x22): undefined reference to ope
rator delete(void*)’
main.o: In function std::ctype_base::~ctype_base()': main.o(.gnu.linkonce.t._ZNSt10ctype_baseD1Ev+0x30): undefined reference to oper
ator delete(void*)’
main.o: In function std::ctype_base::~ctype_base()': main.o(.gnu.linkonce.t._ZNSt10ctype_baseD0Ev+0x30): undefined reference to oper
ator delete(void*)’
main.o(.gnu.linkonce.r._ZTISt10ctype_base+0x0): undefined reference to
vtable f or __cxxabiv1::__si_class_type_info' main.o: In function std::locale::facet::~facet()’:
main.o(.gnu.linkonce.t._ZNSt6locale5facetD1Ev+0x22): undefined reference
to ope rator delete(void*)' main.o: In function std::locale::facet::~facet()’:
main.o(.gnu.linkonce.t._ZNSt6locale5facetD0Ev+0x22): undefined reference
to ope rator delete(void*)' main.o(.gnu.linkonce.r._ZTINSt6locale5facetE+0x0): undefined reference to vtabl
e for __cxxabiv1::__class_type_info’
main.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0’
cc: C:/QNX630/host/win32/x86/usr/bin/i386-pc-nto-qnx6.3.0-ld caught signal
1
c:\QNX630\host\win32\x86\usr\bin\make.exe: *** [all] Error 1
/*********************************************************/

I don’t know why because when I compile like this:
QCC -Vgcc/3.3.1,gcc_ntox86 main.cpp -o main
everything is correctly and main file is created.

Next problem: I can compile this simple program only under bash shell
(C:\QNX630\host\win32\x86\usr\bin\bash.exe) and when I try from QNX
Momentics IDE I have a error:

make -k clean all
rm -rf *.o *.exe
cc: unknown target ‘gcc_ntox86’
cc: no targets defined in {QNX_HOST}/etc/qcc/gcc/3.3.1!
make: *** [all] Error 1
QCC -Vgcc/3.3.1,gcc_ntox86 -LC:/QNX630/target/qnx6/usr/include -c main.cpp
-o main.o

and my makefile is:

CC=QCC -Vgcc/3.3.1,gcc_ntox86
all:
$(CC) -c main.cpp -o main.o
$(CC) main.o -o main

clean:
rm -rf *.o *.exe

Please help me, I’m not familiar with QNX yet
Regards
miksiu

miksiu wrote:

OK. I know already what is wrong.
I add to QCC flags libraries:
CC := QCC -V3.3.1,gcc_ntox86 -lcpp -lcxa -lstdc++ -lm -lsocket -lecpp

Regards
miksiu

Hi,

We are doing a project design in Rhapsody 5.2 targetted for the QNX
Neutrino operating system. We have QNX Momentics 6.3.0 development
suite (standard edition) with SDK and GPL installed at C:\QNX630 on
Windows XP SP2. When I create a class and run it with settings in
Rhapsody configuration file set to QNX Neutrino
Libraries(QNXNeutrinoCW) - it gives me the following errors:


Building ------------ DefaultComponent ------------
Executing: “C:\Rhapsody\Share\etc\qnxcwmake.bat”
DefaultComponent.mak build
Compiling Display.cpp
cc: unknown target ‘gcc_ntox86’
cc: no targets defined in C:/QNX630/target/qnx6/host/win32/etc/qcc!
make: *** [Display.o] Error 1

Build Done

These are the environment variables as they are set:
MAKEFLAGS
-IC:/QNX630/target/qnx6/usr/include

QNX_HOST
C:/QNX630/host/win32/x86

QNX_TARGET
C:/QNX630/target/qnx6

QNX_CONFIGURATION
C:\Program Files\QNX Software Systems


Please tell me if you have any idea about what’s wrong with this.

This is very urgent. I would be really grateful if you can help me out
with this. Thanks a lot in advance.

Regards,
Charles

“charleshb” <bunnycharlesh@infotechsw-dot-com.no-spam.invalid> wrote in
message news:eb79ol$k0s$1@inn.qnx.com

Hi,

Hello Charles,

You’re the first persone I’ve seen using Rhapsody in the newsgroup which
contains less and less professional user, I suggest you find other means of
getting support.

We are doing a project design in Rhapsody 5.2 targetted for the QNX
Neutrino operating system. We have QNX Momentics 6.3.0 development
suite (standard edition) with SDK and GPL installed at C:\QNX630 on
Windows XP SP2. When I create a class and run it with settings in
Rhapsody configuration file set to QNX Neutrino
Libraries(QNXNeutrinoCW) - it gives me the following errors:


Building ------------ DefaultComponent ------------
Executing: “C:\Rhapsody\Share\etc\qnxcwmake.bat”
DefaultComponent.mak build
Compiling Display.cpp
cc: unknown target ‘gcc_ntox86’
cc: no targets defined in C:/QNX630/target/qnx6/host/win32/etc/qcc!
make: *** [Display.o] Error 1

Build Done

These are the environment variables as they are set:
MAKEFLAGS
-IC:/QNX630/target/qnx6/usr/include

QNX_HOST
C:/QNX630/host/win32/x86

QNX_TARGET
C:/QNX630/target/qnx6

QNX_CONFIGURATION
C:\Program Files\QNX Software Systems


Please tell me if you have any idea about what’s wrong with this.

This is very urgent. I would be really grateful if you can help me out
with this. Thanks a lot in advance.

Regards,
Charles

Hello Charles

This line is not correct:

cc: no targets defined in C:/QNX630/target/qnx6/host/win32/etc/qcc!

There is no such directory C:/QNX630/target/qnx6/host/win32/etc/qcc!
Therefore the compiler cannot find out what targets it can compile for.
I believe the directory is supposed to be:

C:/QNX630/host/win32/x86/etc/qcc/

I’m not sure, but it looks like an environment variable is getting
manipulated wrong in qnxcqmake.bat. If you run qcc -V from the command
line what do you get?

Thanks,
Rodney

charleshb wrote:

Hi,

We are doing a project design in Rhapsody 5.2 targetted for the QNX
Neutrino operating system. We have QNX Momentics 6.3.0 development
suite (standard edition) with SDK and GPL installed at C:\QNX630 on
Windows XP SP2. When I create a class and run it with settings in
Rhapsody configuration file set to QNX Neutrino
Libraries(QNXNeutrinoCW) - it gives me the following errors:


Building ------------ DefaultComponent ------------
Executing: “C:\Rhapsody\Share\etc\qnxcwmake.bat”
DefaultComponent.mak build
Compiling Display.cpp
cc: unknown target ‘gcc_ntox86’
cc: no targets defined in C:/QNX630/target/qnx6/host/win32/etc/qcc!
make: *** [Display.o] Error 1

Build Done

These are the environment variables as they are set:
MAKEFLAGS
-IC:/QNX630/target/qnx6/usr/include

QNX_HOST
C:/QNX630/host/win32/x86

QNX_TARGET
C:/QNX630/target/qnx6

QNX_CONFIGURATION
C:\Program Files\QNX Software Systems


Please tell me if you have any idea about what’s wrong with this.

This is very urgent. I would be really grateful if you can help me out
with this. Thanks a lot in advance.

Regards,
Charles