April 23rd, 2008, 09:41 PM
Visual Studio #include
i don't have too much experience of using MS Visual Studio, therefore i need some help. i am trying to write a program using WinSock in Visual C++, so could someone tell be what i need to do to include the "winsock.h" header file, in MS Visual Studio. Beyond the following.
i've tried a number of solutions that i have found on the net, but non of them have completely worked. therefore could anyone help me?
thanks in advance,
April 23rd, 2008, 10:48 PM
That is actually all you need to do. If that's not working, then you have problems somewhere else. What problems are you having with it, exactly?
April 23rd, 2008, 10:55 PM
when i try to use WSAStartup(), then i get a build error. that says:
error LNK2019: unresolved external symbol _WSAStartup@8 referenced in function _main
which is why i think that the "winsock.h" library has not been included in the build. what do you think?
April 23rd, 2008, 11:58 PM
I haven't opened Visual Studio in years and I never used it for anything but Visual Basic, but as I recall there was a setting where you had to import a whole package that contained each library that you intend to reference. It's been too many years for me to tell you where to look and I have no idea how much the program has changed in that time.
I had to do such an import myself just to reference the scripting.filesystem object.
April 24th, 2008, 12:37 AM
that's what i was thinking, that i may have to import the header file into my project.
but, im not sure how to do that. all the attempts that i have made have been unsuccessful ;-(.
although, i could easily be mistaken! anyone, that has any ideas how i could resolve this problem, please let me know.
Last edited by user0182; April 24th, 2008 at 12:54 AM.
April 24th, 2008, 07:26 PM
thanks for your help guys, but i've worked out the answer to my own question! what i needed to do was, on the menus, go to:
project -> properties -> "configuration properties" -> linker -> input -> "additional dependancies"
and add "WS2_32.lib".
April 24th, 2008, 11:38 PM
I'm glad you found it, I was about to tell you that the solution is not coding, but rather part of the menu interface. Anyway you solved it. Congrats!
April 25th, 2008, 08:01 AM
It's actually a linker error. By adding the additional dependencies you're telling the linker to link the ws2_32.lib to your executable making it's functions available.
Experience is something you don't get until just after you need it.
April 25th, 2008, 01:28 PM
Don't know if this'll help you at all, but generally if the problem was that VS couldn't find the header file you would get an error along the lines of:
"Warning C4013: 'my_func' undefined; assuming extern, returning int"
Another way that you can get an idea of whether the issue is a compiler or a linker problem is by looking at the error codes. Compiler problems start with Cxxxx whereas linker problems start with LNKxxxx.
A good way to get help on these problems is to search by that error code.
By wolfman1984 in forum Programming Security
Last Post: December 8th, 2007, 06:50 PM
By Condoor in forum IDS & Scanner Discussions
Last Post: March 21st, 2003, 01:34 AM
By tampabay420 in forum Programming Security
Last Post: February 14th, 2003, 01:36 PM
By Condoor in forum AntiOnline's General Chit Chat
Last Post: February 12th, 2003, 03:08 AM
By ele5125 in forum IDS & Scanner Discussions
Last Post: August 9th, 2002, 03:22 PM