visual studio windows system environment path configuration (and property manager configuration) and some usage problems and solutions

Record some of the problems and solutions encountered before for personal use.


#include <iostream>的位置:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include


包含目录:
#添加Windows.h
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared

#添加opencv
G:\Opencv3.4.5\opencv\build\include\opencv2
G:\Opencv3.4.5\opencv\build\include\opencv
G:\Opencv3.4.5\opencv\build\include


Library directory:
#Add Windows.h
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0 \ucrt\x64


opencv2.4.9
#Add opencv
G:\Opencv3.4.5\opencv\build\x64\vc15\lib
---------------------------- -------------------------------------------------- -----------------------
Additional dependencies
opencv_world345d.lib


LNK1104: Unable to open file kernel32.lib Solution Solution
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64


link110 vs2017 cannot open the file "msvcprt.lib"/"msvcprtd.lib"
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x86


It's because the v142 tool set is not installed. In fact, v142 corresponds to VS2019. My project was copied from another computer. The previous compiler was VS2019, but now it is VS2017, so this error was reported.
v142–>VS2019
v141–>VS2017
v140–>VS2015
v120–>VS2013

How to call up the property manager "Debug| Release|" these
VS 2017 -> View -> Other Windows -> Property Manager


How to send a C++ exe program to others so that they can be used
1. If the computer prompts that XXXD.dll is missing
, it means that the exe program was generated by debug. "D" means that debug
requires release. When generating .exe, pay attention to the difference between 64-bit and 32-bit.

2. The computer prompts that XX.dll is missing
, indicating that there is no VS 2017 runtime library on other people’s computers.
Solution 1: (applicable to ordinary consoles, etc., not applicable to MFC)
project property page--C/C++--all options--run Library - Change "Multi-threaded DLL (/MD)" to "Multi-threaded (/MT)" for
release. You can find that the exe file generated in this way has obviously become larger because he has compiled all these libraries.

Solution 2: Install the corresponding library
Microsoft Visual C++ 2017 Redistributable on the other party’s computer


Debugging of the program:
Start debugging F5: it will stop when it encounters a breakpoint. Pressing step-by-step F10 will run the statement line where the breakpoint is.
Start execution without debugging Ctrl+F5: it will not stop at the breakpoint.

Start debugging F5 without adding a breakpoint, and the program will not stop.

Let the exe program generated by debug stop after being opened in a single machine; and without adding a breakpoint, start debugging and stop using F5. You
can use: "system("pause")", which is only valid on Windows.


The difference between process-by-process F10 and statement-by-statement F11 and jump out is that
statement-by-statement will enter the function at the breakpoint, while process-by-process will not
jump out. After entering the function at the breakpoint, press jump out, and the statements in the function will not continue to run. , jump out to the first statement after the function is executed

Continue with F5

When debugging using breakpoints, move the mouse to a variable. After fixing it, you can see what its value is, and the breakpoint can
set the conditions for changing the quantity, such as letting a stop when it is equal to 10000 in a loop. , you can set the condition "a == 10000" at the breakpoint, and then press
F5, the loop will run automatically until it stops when a equals 10000.


Microsoft Visual C++ 2017 Redistributable(x64)的位置
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.16.27012\vc_redist.x64.exe


Modify the generation location of the dll file:
Project property page-Linker-General-Output file: Change $(Outdir)$(TargetName)$(TargetExt) to .\$(TargetName)$(TargetExt) to change the original file
in X64 The \debug folder generates .dll files directly in the home directory.

Note that the project property page - General - the configuration type is dynamic library (.dll)

Guess you like

Origin blog.csdn.net/Yang_4881002/article/details/127169074