Reputation: 107
I am trying to run a socket programming on qnx momentics on IDE 4.7 , the code was written by someone else , it is getting compiled on his pc i was just asked to build it and run on our target. I am getting this error., The code has both and , but it is throwing error "undefined reference to 'accept'" ,"undefined reference to 'bind'","undefined reference to 'listen'", my pc is windows 7, could anyone tell me how to resolve this?
Upvotes: 1
Views: 3270
Reputation: 103
Link the libraries manually. For examples if you are using a Makefile project then add the below line
LIBS += -L<Path to QNX SDP>\target\qnx7\aarch64le\lib -lsocket
and then rebuild the project
Upvotes: 1
Reputation: 1290
Normally when you include just a header file, all the methods and variables are accessible and resolved. But when you actually try to build the project, it starts looking for that method definitions and if not found, throw an error.
Example: HAM in QNX, I wanted to use these lines,
ham_entity_t *ehdl;
ham_condition_t *chdl;
ham_action_t *ahdl;
ham_connect(0);
and I just included,
#include "ha/ham.h"
So far so good, but when I tried to build using QNX IDE, it gave me the error undefined reference
Then, I followed this steps.
Now in your case, only in last step you have to type "socket" and rebuild the project.
Hope this helps.
Upvotes: 2