0

I currently have my VSCode C++ environment setup using mingw. I'm attempting to start playing with the winsock library, but I'm caught up at creating the build environment, since I've used an IDE for the most part in the past.

Step 2 from Microsofts documentation states: "Ensure that the build environment refers to the Include, Lib, and Src directories of the Microsoft Windows Software Development Kit (SDK) or the earlier Platform Software Development Kit (SDK)."

Does this just mean to throw these in a folder in the project and #include them somehow? Then

Step 3 from Microsofts documentation states: "Ensure that the build environment links to the Winsock Library file Ws2_32.lib. "

Again, I'm not quite sure how to link to the Winsock library file, or if that just means have a folder with it. I'm new to creating projects.

halfer
  • 19,824
  • 17
  • 99
  • 186
Alias
  • 1
  • *throw these in a folder in the project* No. This approach leads to troubles. If you've got one of the better MinGW distributions this will all be done for you. If not, in one of the project's JSON configuration files you must specify the location of the include and library folders. Then you include the headers as normal and probably add a few more items to the configuration to request the files be linked. – user4581301 Apr 17 '22 at 03:57
  • Gotcha, I've actually never used a JSON file for a program before. I've strictly been in a pure CPP environment so this is all new to me. I downloaded the most recent MinGW and updated everything. Are there any good resources for setting up a project how you're describing? – Alias Apr 17 '22 at 04:00
  • In general don't throw libraries in your project folder. Install them property and point the build tools at them. – user4581301 Apr 17 '22 at 04:00
  • Most recent MinGW gets weird. There are many distributions and some of them are... quite old. You get the most recent of one of those distributions and you may find yourself with GCC 4, rather than the current mainstream 11. [I use this one](https://stackoverflow.com/questions/30069830/how-to-install-mingw-w64-and-msys2) because it's as cutting-edge as you want and it has a package manager that you can use to install an impressive ecosystem of tools and libraries. – user4581301 Apr 17 '22 at 04:02
  • OHHH, I think I see. That's the same one I installed, so I just need to install those packages it looks like using the -pacman -S, so like -pacman S win64_SDK(or something along those lines) then it will be installed and automatically in my build environment on runtime. So in the case of above, it'll refer to include, lib and src automatically? Thank you for being patient btw – Alias Apr 17 '22 at 04:07
  • No worries. I can't help you with configuring VSCode, but it sounds like you have the right tools. Everything you need to winsock programming should already be built in when you install the GCC compiler. I'd suspect the same with clang, but never tested that out. – user4581301 Apr 17 '22 at 04:13
  • Awesome, looks like your right, I was able to compile everything together. Appreciate the help! – Alias Apr 17 '22 at 04:17

0 Answers0