User forums > Using Code::Blocks

Visual studio compiler configuration still use gcc.exe

<< < (2/2)

I am the one who wrote that MSVC configuration document.

I have been using MSVC with Code::Blocks since Visual Studio 2005 and now using Visual Studio 2019. The idea with the global variables is that it makes it possible to isolate the C::B project file from a particular MSVC version (to some degree) and also allow using MSVC Professional vs. Free editions on different computers without modifying the C::B project file.

If your project is still compiling with gcc it is likely your project compiler is declared as "gcc".

What I do is to create a generic MSVC compiler called "msvc" as described, and then use the "msvc" compiler in the projects. Btw. I also use a custom project file generator that simplifies this, it runs as a separate tool although it could have been made as a C::B plugin probably. It creates msvc and gcc build targets so I can build on Windows using msvc and gcc on linux
It uses the UserTemplates folder to generate projects of different kinds by simple text search/replace

Instead of trying a bluetooth example, I compiled a TCP/IP example using gcc. It worked, but I had to add the following define before the includes for the compilation to work:

--- Code: ---#define _WIN32_WINNT 0x0501
--- End code ---

So TCP/IP is supported by MinGW, but not bluetooth. Then I completed the tutorial made by cacb and it now called cl.exe correctly. But even if I set the includes path correctly, it cannot find "winsock2.h" and "corecrt.h". The second file does not seem to exist on my hard drive.

The next solution would be to try upgrading the Win SDK to 10 if I really need MSVC.


[0] Message Index

[*] Previous page

Go to full version