Tag Archives: visual studio code

Modify the custom keyboard shortcut of visual studio code

Many IDEs, such as Eclipse and Visual Studio Code’s Auto Completion Intellisense shortcut key, use Ctrl + Space, which conflicts with Chinese developers’ cases of switching Chinese and English input methods, which is very annoying.
How to toggle IntelliSense shortcut key definitions in Visual Studio Code:
File-> Preferences-> Settings Enter the Settings menu:

Go to the Trigger Suggest’s original button Settings: Ctrl + Space

I changed it to a different combination: Ctrl + L

Now press Ctrl + L to trigger the autocomplete function, which will no longer interfere with the Chinese/English input method.

For more Jerry’s original articles, please follow the official account Wang Zixi :

Successfully solved the problem that visual studio code could not go to the definition, and there was no mouse prompt

Visual Studio Code does not prompt the definition I can not solve

Today suddenly found my vscode without prompt, not even to the definition of function, it was like a TXT text reader, then I have been to install a plug-in, even put vscode uninstall reinstall is useless, I finally in a prompt window to set the configuration file that I have a set of changes over the
I C_Cpp.
the picture intelliSenseEngine was transformed to Disable, lead to code doesn’t provide context awareness, Then change to Default according to the selection prompt

Vs configure tensorrt environment to use

Install the Nvidia driver (same as before)
2. Install the CUDA10 version, do not select Compact, select Custom and then select All.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Make sure you have CUDA installed and don’t continue without it.
②. Create a new project – select nvidia-cuda xx, select your name and define your path.
③. Remove the kernel.cu file and add your own CPP, CU, H files.
④. Configuration header file
Conventional – character set for double-byte character or not
c/c + + – general – additional include directories
E: \ opencv300 \ opencv \ build \ include \ opencv2
E: \ opencv300 \ opencv, build, include, opencv
E: \ opencv300, opencv, build, include the
D: \ tensorRTIntegrate \ TensorRT – master \ third_party \ cub
D: \ tensorRTIntegrate \ TensorRT – master \ include
C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ include
D:\ TensorrtIntegrate \ Tensorrt-master \ Plugin
C/C ++ – Secure_No_Warnings
/ C ++ – Preprocessor – Warnings
D:\ TensorrtIntegrate \ Tensorrt-master \ Plugin
C/C ++ – Preprocessor – Warnings

C/C ++ – Precompiled header – Precompiled header – Do not use the precompiled header
CUDA C/C ++ -Common-Additional Include Directories
C: ProgramData\NVIDIA Corporation\CUDA Samples\ V10.0 \ Common \ Inc
DA C/C ++ -Device – Code Generation
te_75, SM_75 Note: Here the numbers are changed based on the graphics card power, the GPU2080/2080TI power is 75.
linker
– general – additional libraries directory E: \ opencv300 \ opencv, build, x64, vc12 \ lib
D: \ tensorRTIntegrate \ lean \ cuda10.0 \ lib
C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0 \ lib \ x64
D:\tensorRTIntegrate\lean\ tensorrt-6.0.1.5 \lib
Linker
dadevrt.lib
c>t.lib
cudart_>ic.lib
cudnn.libb7 cufft.lib
>ftw.lib
c>t.lib curand.lib
cusolver.lib
cusparse.lib
nppc.lib
nppial.lib
nppicc.lib
nppicom.lib
nppidei.lib
nppif.lib
nppig.lib
nppim.lib
nppist.lib
nppisu.lib
nppitc.lib
npps.lib
nvblas.lib
nvgraph.lib
nvml.lib
nvrtc.lib
OpenCL.lib
nvinfer.lib
nvinfer_plugin.lib
nvonnxparser.lib
nvparsers.lib
opencv_ts300.lib
Opencv_ts300d. lib
opencv_world300.lib
encv_world300d. lib
P> the DLL files of Tnesorrt and the DLL files of OpenCV in the project directory.
Tnesorrt DLL path: D: \ tensorRTIntegrate \ lean \ TensorRT – 6.0.1.5 \ lib DLL file:

nvinfer. DLL
nvinfer_plugin. DLL
nvonnxparser. DLL
nvparsers. DLL
nvserialize. DLL
OPENCV DLL path: E: \ opencv300 \ opencv, build, x64, vc12 \ bin DLL file:

opencv_ffmpeg300_64. DLL
opencv_world300. DLL
opencv_world300d. DLL
configured above, you can compile.

Solve the problem of vscode window console “flash”

Many friends in the use of VS Code, after running the program window console may flash past. At this point, the code is completely running, but the result is not visible. To do this, we can do configution by setting up a CMD configuration, as shown below:
Open the launch.json file and add

{
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "cmd",
            "args": [
                "/C",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "&",
                "pause"
            ],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole":true
        },

Note that the code is added in

 "version": "0.2.0",
    "configurations": [

and

{
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],

In this case, you may find that this is just a case of keeping the old configuration and building a new platform, so that the runtime starts with window… Just run it
For convenience, share launch.json as follows:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(Windows) Launch",
            "type": "cppvsdbg",
            "request": "launch",
            "program": "cmd",
            "args": [
                "/C",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "&",
                "pause"
            ],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole":true
        },
        {
            "name": "g++.exe - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "g++.exe build active file"    
        }
    ]
}

Hope the above content is helpful to readers (especially students)!
In the latest update, the Windows command box method is not debugable, so the breakpoint pause method is still recommended. hhhh

Cargo invoice has failed: error: exit code: 101

Rust language
When you edit the Rust “Thebook” second chapter “guess” game Code in VS Code, try adding a rand dependency in cargo. Toml, which is

cargo.toml

[dependencies]
rand = "0.7.3"

after typing $cargo build on the command line,

is found

Cargo invocation has failed: Error: exit code: 101.

such a popup reminder, prompt crate enable failure.

OUTPUT window prompts as follows:

Running `cargo build --bin=instances --package=instances
--message-format=json`...
    Blocking waiting for file lock on package cache
    Updating crates.io index warning: spurious network error (2 tries remaining): failed to send request: 操作超时 ; class=Os (2) 
    warning: spurious network error (1 tries remaining): failed to send request: 操作超时 ; class=Os (2) 
    error: failed to get `rand` as a dependency of package `instances v1.46.0 (D:\DataFiles\CodesLearning\RUST\Instances)`

Caused by:   failed to load source for dependency `rand`

Caused by:   Unable to update registry `https://github.com/rust-lang/crates.io-index`

Caused by:   failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:   failed to send request: 操作超时  ; class=Os (2)

it turned out that the connection to Github was timed out. This problem will also be pop-ups for installed updates that are ignored when checking the rust-Analyzer plug-in version every time VS Code is started.

below provides the method to connect to Github. This method also applies to the problem of not being able to connect to Github when a web page is logged on. IP addresses are usually added to the HOSTS file.
host files in C:// Windows/system32/dreivrs/etc directory. You can right click -> Property changes the write permission of User before editing and saving.
can be learned that the current lot by https://github.com.ipaddress.com/www.github.com website IP address has been changed, so a lot of articles referred to in the hosts change have failed. The code added to the hosts file is provided as follows:

#Github
140.82.113.4 github.com 

of course, it is more recommended to use the above link to query before making changes, to prevent IP address update invalid. Finally, don’t forget to save the file hosts, , and unwrite User .