Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Using network sockets from QNX C++ projects: (2 Items)
   
Using network sockets from QNX C++ projects  
Hello,

I've got a project, which I've developed a significant portion of in C++. So I went ahead and created a QNX C++ project 
in Momentics. To my knowledge, there are no C++ abstractions for the networking objects, so I tried encapsulating the C-
based data/methods within an object and calling that. As a result, I cannot get the project to link properly, as it 
cannot resolve references to the C socket api (bind, etc.). Is there any workaround for this issue? I'm going to try 
making the C++ code into a library and having a C project link against this, but it seems like this is an issue that has
 been run into before. 

I've attached a brief log snippet below. Thanks in advance for your assistance. 

Best Regards,
Tim Meese

"C:\\qnx660\\host\\win32\\x86\\usr\\bin\\make.exe" -k "CPULIST=arm x86" "EXTRA_SUFFIXES=cpp " all --file=C:/Users/
meeset1/AppData/Local/Temp/QMakefile14165172938945212259667251343547.tmp 
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Carm -fMakefile all 
make.exe[1]: Entering directory `C:/Users/meeset1/qde-5.0-workspace/ProtocolTest/arm'
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Co-le-v7 -fMakefile all 
make.exe[2]: Entering directory `C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7'
C:/qnx660/host/win32/x86/usr/bin/rm -f  C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest
C:/qnx660/host/win32/x86/usr/bin/qcc -Vgcc_ntoarmv7 -Wl,--no-keep-memory  -lang-c++ -lang-c++    -o C:/Users/yyy/qde-5.0
-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest    Dispatcher.o    Parser.o    Protocol.o    UDPServer.o    main.o   -L
 . -L C:/qnx660/target/qnx6/armle-v7/lib -L C:/qnx660/target/qnx6/armle-v7/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link 
C:/qnx660/target/qnx6/armle-v7/lib -Wl,--rpath-link C:/qnx660/target/qnx6/armle-v7/usr/lib    -EL          
UDPServer.o: In function `UDPServerInit':
UDPServer.c:(.text+0x16): undefined reference to `socket'
UDPServer.c:(.text+0x4c): undefined reference to `bind'
UDPServer.o: In function `UDPServerReplyTo':
UDPServer.c:(.text+0x98): undefined reference to `sendto'
UDPServer.c:(.text+0xa2): undefined reference to `inet_ntoa'
make.exe[2]: Leaving directory `C:/Users/meeset1/qde-5.0-workspace/ProtocolTest/arm/o-le-v7'
UDPServer.c:(.text+0xbe): undefined reference to `inet_ntoa'
UDPServer.o: In function `UDPServerRecvFrom':
UDPServer.c:(.text+0x128): undefined reference to `recvfrom'
UDPServer.c:(.text+0x13c): undefined reference to `inet_ntoa'
cc: C:/qnx660/host/win32/x86/usr/bin/arm-unknown-nto-qnx6.6.0eabi-ld caught signal 1
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Co-le-v7-g -fMakefile all
make.exe[2]: *** [C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[1]: [all] Error 2 (ignored)

Re: Using network sockets from QNX C++ projects  
You need to link against libsocket.

Sent from my BlackBerry 10 smartphone on the Rogers network.
  Original Message
From: Tim Meese
Sent: Thursday, November 20, 2014 5:49 PM
To: osmeta-core_os
Reply To: osmeta-core_os@community.qnx.com
Subject: Using network sockets from QNX C++ projects


Hello,

I've got a project, which I've developed a significant portion of in C++. So I went ahead and created a QNX C++ project 
in Momentics. To my knowledge, there are no C++ abstractions for the networking objects, so I tried encapsulating the C-
based data/methods within an object and calling that. As a result, I cannot get the project to link properly, as it 
cannot resolve references to the C socket api (bind, etc.). Is there any workaround for this issue? I'm going to try 
making the C++ code into a library and having a C project link against this, but it seems like this is an issue that has
 been run into before.

I've attached a brief log snippet below. Thanks in advance for your assistance.

Best Regards,
Tim Meese

"C:\\qnx660\\host\\win32\\x86\\usr\\bin\\make.exe" -k "CPULIST=arm x86" "EXTRA_SUFFIXES=cpp " all --file=C:/Users/
meeset1/AppData/Local/Temp/QMakefile14165172938945212259667251343547.tmp
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Carm -fMakefile all
make.exe[1]: Entering directory `C:/Users/meeset1/qde-5.0-workspace/ProtocolTest/arm'
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Co-le-v7 -fMakefile all
make.exe[2]: Entering directory `C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7'
C:/qnx660/host/win32/x86/usr/bin/rm -f  C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest
C:/qnx660/host/win32/x86/usr/bin/qcc -Vgcc_ntoarmv7 -Wl,--no-keep-memory  -lang-c++ -lang-c++    -o C:/Users/yyy/qde-5.0
-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest    Dispatcher.o    Parser.o    Protocol.o    UDPServer.o    main.o   -L
 . -L C:/qnx660/target/qnx6/armle-v7/lib -L C:/qnx660/target/qnx6/armle-v7/usr/lib  -Wl,--rpath-link . -Wl,--rpath-link 
C:/qnx660/target/qnx6/armle-v7/lib -Wl,--rpath-link C:/qnx660/target/qnx6/armle-v7/usr/lib    -EL
UDPServer.o: In function `UDPServerInit':
UDPServer.c:(.text+0x16): undefined reference to `socket'
UDPServer.c:(.text+0x4c): undefined reference to `bind'
UDPServer.o: In function `UDPServerReplyTo':
UDPServer.c:(.text+0x98): undefined reference to `sendto'
UDPServer.c:(.text+0xa2): undefined reference to `inet_ntoa'
make.exe[2]: Leaving directory `C:/Users/meeset1/qde-5.0-workspace/ProtocolTest/arm/o-le-v7'
UDPServer.c:(.text+0xbe): undefined reference to `inet_ntoa'
UDPServer.o: In function `UDPServerRecvFrom':
UDPServer.c:(.text+0x128): undefined reference to `recvfrom'
UDPServer.c:(.text+0x13c): undefined reference to `inet_ntoa'
cc: C:/qnx660/host/win32/x86/usr/bin/arm-unknown-nto-qnx6.6.0eabi-ld caught signal 1
C:/qnx660/host/win32/x86/usr/bin/make.exe -j 1 -Co-le-v7-g -fMakefile all
make.exe[2]: *** [C:/Users/yyy/qde-5.0-workspace/ProtocolTest/arm/o-le-v7/ProtocolTest] Error 1
make.exe[2]: Target `all' not remade because of errors.
make.exe[1]: [all] Error 2 (ignored)





_______________________________________________

OSMeta
http://community.qnx.com/sf/go/post112395
To cancel your subscription to this discussion, please e-mail osmeta-core_os-unsubscribe@community.qnx.com