Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ / Xcode Sockets bind() Error

Tags:

c++

xcode

sockets

When trying to process the return value (should be int) from sys/sockets.h bind(), Xcode fails to compile with the error

Invalid operands to binary expression ('__bind' and 'int')

It seems to be pulling the incorrect function definition for bind(), because when I choose "Jump to definition" from the contextual menu, it gives me three options: 2 definitions from functional.cpp, and 1 from sys/sockets.h. I have sys/sockets included in my code, how to I force the compiler to use the correct definition?

like image 955
Calteran Avatar asked Apr 23 '13 22:04

Calteran


1 Answers

Use ::bind or get rid of the using namespace std;.

like image 134
Jesse Good Avatar answered Sep 22 '22 11:09

Jesse Good