![]() |
| ||
| Port Scanner in C++ Hi all I was looking for a port scanner to see what was open on my laptop and I thought as I was learning C++ why not search for a C++ port scanner. I came across this code I can make sense of most of it but it wont compile. I have linked the -lws2_32 file that I was told is needed because I use Dev, I looked in Project -> Project Options -> Parameters -> and i went to the little folder icon and searched for the library in the lib but it wasn't there is i just went to the "Linker" edit box and typed -lws2_32 but that didn't work either. Here is the code /*-------------------- These are the error messages I am getting on line 46 it has a comment underneath C:\Dev-Cpp\port.cpp In function `int main()': C:\Dev-Cpp\port.cpp [Warning] passing NULL used for non-pointer converting 3 of `int connect(SOCKET, const sockaddr*, int)' [Linker error] undefined reference to `__cpu_features_init' C:\Dev-Cpp\port.cpp ld returned 1 exit status Can someone please explain what is wrong, I think it is because I am not linking that file correctly? Cheers HLA91 |
| ||
| Re: Port Scanner in C++ C++ is a little bit more strict about how it defines NULL than C. The compiler is complaining because you are passing a (void *)0 as the third argument, when it expects an (int)0. Hope this helps. |
| ||
| Re: Port Scanner in C++ Can you explain in a bit more detail please, I don't quite get what you are saying? |
| ||
| Re: Port Scanner in C++ Say nret = connect(sock, NULL, 0);C++ defines NULL as a pointer. |
| All times are GMT -4. The time now is 4:29 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC