PDA

View Full Version : cannot convert size_t to socklen_t for argument 3 in int getsockname


inkubus
07-15-2007, 12:37 AM
Hi i'm getting an error when compiling with gcc 3.3.5 on suse 9.3.

Any suggestions?gcc -c -Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wcomment -Wcast-align -Wno-deprecated -g -O -pthread -pipe -I../common/SocketLib -DFX -D_GNU_SOURCE -DINVERSEXY -DWORLD -DDEBUG=5 -DEQDEBUG=5 -DSHAREMEM -DCATCH_CRASH -DNO_PIDLOG -DFIELD_ITEMS -DIRC -Di386 -DAPP_OPCODE_SIZE=2 -DEMBPERL -DEMBPERL_PLUGIN -DHAS_UNION_SEMUN -I/usr/include/mysql -fmessage-length=0 -g -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -fno-strict-aliasing -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl5/5.8.6/x86_64-linux-thread-multi/CORE ../common/TCPConnection.cpp -o ../common/TCPConnection.o
../common/TCPConnection.cpp: In member function `bool TCPConnection::GetSockName(char*, uint16*)':
../common/TCPConnection.cpp:148: error: cannot convert `size_t*' to `socklen_t*' for argument `3' to `int getsockname(int, sockaddr*, socklen_t*)'
make[1]: *** [../common/TCPConnection.o] Error 1

inkubus
07-15-2007, 03:37 AM
I resolved this problem by installing suse 32-bit instead of 64-bit. So I guess if anyone else runs into this issue it's something related to that.

Cheers

Inky

John Adams
07-16-2007, 10:04 AM
I believe long ago, I too had problems compiling on FC x86_64, and went back to 32bit. I am currently trying x64 again, but it sounds like the problem persists.

Darq
02-21-2008, 06:17 AM
in common/TCPConnection.cpp

go to slightly above line 148
see #ifdef WIN32
and so on
remove all those #ifdef #elseif #endif and everything inbetween

replace with
socklen_t addrlen;
should compile on x86_64

thats the quick and dirty method of course