1.
-------------- Build: Debug in example_mic (compiler: Microsoft Compiller)---------------
link.exe /nologo /LIBPATH:"..\..\..\..\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include" /out:bin\Debug\example_mic.exe obj\Debug\main.obj /debug
LINK : fatal error LNK1104: cannot open file 'msvcprtd.lib'
Process terminated with status 1104 (0 minute(s), 0 second(s))
1 error(s), 0 warning(s) (0 minute(s), 0 second(s))
2.
Code::Blocks 16.01
Windows 10
3.
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
This is obviously wrong: /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include"
You need to pass path where libraries are stored and not where the include files are stored.
Interestingly enough there is no guide how to set vc++ in the wiki any more. :( :o
Now I'm gettings this:
-------------- Clean: Debug in example_mic (compiler: Microsoft Compiller)---------------
Cleaned "example_mic - Debug"
-------------- Build: Debug in example_mic (compiler: Microsoft Compiller)---------------
cl.exe /nologo /W3 /EHsc /MDd /Zi /D_DEBUG /I"..\..\..\..\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt" /I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib" /c main.cpp /Foobj\Debug\Users\lucao\Desktop\example_mic\main.obj
main.cpp
main.cpp(1): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I don't know what you're doing, but you've swapped the paths for includes and libraries.
The /I options must point to the include folders and /LIBPATH options must point to the library folders.
Yeah, the "Search Directories" option is the one managing the include folders, the "Linker Settings" is the one managing the library folders.
Well, I guess this build log is now ok:
-------------- Build: Debug in example_mic (compiler: Microsoft Compiller)---------------
Target is up to date.
Nothing to be done (all items are up-to-date).
The libraries linked where: msvcprtd.lib, msvcrtd.lib, oldnames.lib, ucrtd.lib, vcruntimed.lib, ucrtd.lib, kernel32.Lib
The search directories are:
..\..\..\..\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt
..\..\..\..\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
But now "Build and run" wants the VCRUNTIME140D_APP.dll.
Newer versions of MSVC will need some adaptions.
Well, I have configured Code::Blocks to compile using Microsoft Visual Studio Build Tools 2017.
-------------- Build: Debug in example_mic (compiler: Microsoft VC 2017)---------------
Target is up to date.
Nothing to be done (all items are up-to-date).
-------------- Run: Debug in example_mic (compiler: Microsoft VC 2017)---------------
Checking for existence: C:\Users\lucao\Desktop\example_mic\bin\Debug\example_mic.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\lucao\Desktop\example_mic\bin\Debug\example_mic.exe" (in C:\Users\lucao\Desktop\example_mic\.)
Process terminated with status 0 (0 minute(s), 1 second(s))
Where is the Code::Blocks global compiler settings file stored?
You have to differentiate between two types of compiler configuration, the global one and the project specifc one. In the global configuration i put everything that is required to build for a specific target environment, in the project one (which are multiple in fact) i put everything required for the specific project configuration, in my case its Debug and Release.
I dont have Visual Studio 2017 and i dont build for x64, i have Visual Studio 2015 and i build for x32 with the Windows XP toolkit, so my paths are different than yours and i need some extra settings, but this should outline the steps anyway.
Global Configuration
Compiler settings / Other compiler options
/FS -> required for parallel build to work
Compiler settings / #defines
_USING_V110_SDK71_ -> required for Windows XP toolkit
Search directories / Compiler
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include -> required for Windows XP toolkit
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
Search directories / Linker
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\lib -> required for Windows XP toolkit
C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86
Search directories / Resource compiler
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include -> required for Windows XP toolkit
C:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt
Toolchain executables / Compiler's installation directory
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
Toolchain executables / Additional Paths
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\bin
Other Settings / Advanced options / Link object files to executable
$linker /nologo /subsystem:windows,5.01 $libdirs /out:$exe_output $libs $link_objects $link_resobjects $link_options -> required for Windows XP toolkit
Other Settings / Advanced options / Link object files to console executable
$linker /nologo /subsystem:console,5.01 $libdirs /out:$exe_output $libs $link_objects $link_resobjects $link_options -> required for Windows XP toolkit
Now the following project settings are almost like the defaults that Visual Studio uses itself (note: the command line compiler DOES NOT use these as defaults, thats why i have to specify them)
Debug Configuration
Compiler settings / Compiler Flags
/Zi
/W4
/Od
/fp:precise
/GR
/RTCsu
/Gm
/MDd
Compiler settings / Other compiler options
/EHsc
Compiler settings / #defines
_CRT_SECURE_NO_DEPRECATE -> to get rid of annoying warnings of otherwise perfect standard compliant code
_DEBUG
UNICODE
_UNICODE
Linker settings / Other linker options
/DEBUG
/INCREMENTAL
/MANIFEST
/DYNAMICBASE
/NXCOMPAT
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
Release Configuration
Compiler settings / Compiler Flags
/W4
/O2
/fp:precise
/GR
/MD
Compiler settings / Other compiler options
/EHsc
Compiler settings / #defines
_CRT_SECURE_NO_DEPRECATE -> to get rid of annoying warnings of otherwise perfect standard compliant code
NDEBUG
UNICODE
_UNICODE
Linker settings / Other linker options
/INCREMENTAL:NO
/MANIFEST
/DYNAMICBASE
/NXCOMPAT
/MANIFESTUAC:"level='asInvoker' uiAccess='false'"
This is enough to build simple Hello World console applications. Depending on your project you need to add additional search directories for the compiler and linker and add your libraries to link with, but you only add them by name, e.g. you add under Link libraries kernel32 and uuid without path, they are searched for in the paths you defined in the Global Configuration.