I am not an expert about such Windows internals, but so far i always used the default Windows SDK shipped with MSVC and i didn't have any problems creating applications for older Windows releases. With MSVC 2015 even today i still target Windows XP. Your problem is that you are using an old SDK that uses features that are removed in your recent compiler. You don't have to use that old SDK to target Windows 7, you can use the latest Windows 10 SDK, but you might need to limit the API level by setting the proper define.
Looking at GCC, the problem is more difficult. GCC, or better the MinGW distribution, doesn't use the Windows SDK from Microsoft but uses an own variant. This does not offer the full abilities the Microsoft one offers. Socket programming works without problems (although i don't recommend using raw sockets in 2021), Bluetooth might work or not, i don't know.
Your referenced documentation to setup MSVC with CodeBlocks is kind of the premium variant, it tries to offer everything that MSVC offers with the flexibility to easily change version numbers. Most probably you don't need everything of that, you can also do it without all these global variables, at the price that you need to update quite a bunch of paths after most MSVC updates. I have posted my setup in the past, sadly its very outdated for MSVC 2019. I have a more recent configuration i am using now with MSVC 2019 (and Bluetooth works with that one because i'm using that in one of my applications
), but i didn't update my MSVC 2019 in a long time, so all paths are wrong again. I could post it as-is, but that configuration won't work without updating the paths.