1

I recently started programming in C++ and required a specific library (Ws2_32.lib) that comes with visual studio. I was reluctant to download visual studio for something so simple but couldn't find an alternative. The problem is that it has been 43 hours and visual studio community 2015 has still not finished installing. I have searched for this problem and common solutions and have crossed a few off the list:

1. It isn't to do with network connection (the network has been connected the whole time and the acquiring bar is full, it is stuck on the applying stage)
2. It isn't just a long install (average install for visual studio is an hour)

Is there a way to fix this and/or get Ws2_32.lib seperately?

EDIT: The install is not hung, it is still installing just incredibly slowly.

screen shot of the installer

  • "I was reluctant to download visual studio" ... there's you problem, VS feels your reluctance (... don't mind me, I'm just fooling around) – Adrian Colomitchi Dec 25 '16 at 00:21
  • You are *so lucky* with 40 hours. Merry Christmas :) – A.S.H Dec 25 '16 at 00:24
  • That install is hung, try to cancel it, if it doesn't cancel then kill it. Judging from the screenshot it seems to have something to do with Java. For your library, check if it's in the SDK. – Cheers and hth. - Alf Dec 25 '16 at 00:24
  • the install is not hung, just incredibly slow, it has moved on to the android SDK now (after about an hour on the java SDK) – John Molotov Dec 25 '16 at 00:27
  • Pretty impossible to tell, why you selected to install *Java SE Development Kit* if all you need is a single Windows API library (which happens to be [available as a separate download](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk), too). Visual Studio takes its time to install. You can reduce the time by judiciously selecting only those components you need. – IInspectable Dec 27 '16 at 15:50
  • I made it do the default install, that normally only includes essentials. – John Molotov Dec 28 '16 at 00:33
  • That's odd, considering that the [C/C++ toolchain isn't even part of the default (*"Typical"*) setup](https://blogs.msdn.microsoft.com/vcblog/2015/07/24/setup-changes-in-visual-studio-2015-affecting-c-developers/). Maybe this tool *is* too complex for you still. – IInspectable Dec 28 '16 at 12:17

2 Answers2

1

If you don't actually want the VS IDE, you should simply download the MinGW C++ compiler from somewhere like http://tdm-gcc.tdragon.net which includes import libraries for all of the Win32 APIs. Installing takes about 5 minutes.

  • I already have MinGW, but it doesn't seem to have the winsock libraries (including Ws2_32.lib) if it does infact have them and i'm being an idiot, how would I access them? – John Molotov Dec 25 '16 at 00:35
  • note: I'm using #pragma comment(lib, "Ws2_32.lib") to load the library – John Molotov Dec 25 '16 at 00:37
  • I'm not sure GCC supports that pragma. See http://stackoverflow.com/questions/2033608/mingw-linker-error-winsock –  Dec 25 '16 at 00:38
  • Note that gcc's libraries can have a `*.a` extension, not just `*.lib`. Also, you can specify the libraries on the command-line or in your project (that depends on the IDE you're using). It wouldn't make sense to have a compiler that's used by thousands in the Windows environment to not have the ability to call Winsock functions. – PaulMcKenzie Dec 25 '16 at 00:44
  • Thanks, I've added the library from the command line and now have 1 less error, only 5 to go! I hate windows... – John Molotov Dec 25 '16 at 01:01
  • MinGW is pretty much useless. It could be a nice way to use a fine compiler on Windows, but the tooling is so brittle, that it breaks when you look at it funny. No really, this isn't a solution. – IInspectable Dec 27 '16 at 15:52
1

The Windows SDK is available as a separate download (see Windows 10 SDK). You don't need Visual Studio to get the Windows Sockets 2 libraries.

If you do want to use Visual Studio for Windows programming (an this is highly recommended), make sure to only install those features, that you are actually planning to use. Even though 43 hours is longer than anything I have heard reports from, installing Visual Studio can take considerably longer than setting up an entire OS.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
  • While I do have to use windows for this I am not willing to sell my soul to Microsoft more than I have to. The problem has been solved. – John Molotov Dec 28 '16 at 00:35