Published Apr 30, 2020
注意在虚拟机设置和安装系统过程中设置网络
应用程序 -> 系统工具 -> 设置 -> Region & Language -> 输入源 -> + -> 汉语(Intelligent Pinyin)
~/.bashrc
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
yum install epel-release
yum install qt-creator kdevelop
https://www.jetbrains.com/clion/download/download-thanks.html
wget https://download.jetbrains.com/cpp/CLion-2020.1.2.tar.gz
Code Style
File -> Setting -> Editor -> Code Style -> C/C++ -> Set from... ->Google
Spaces -> Other -> */&
Managing Makefile Projects
https://github.com/chriskohlhoff/asio.git
asio-1-8-3
./autogen.sh
./configure
https://github.com/nginx/nginx.git
1.16.1
./configure
https://github.com/lua/lua.git
5.1.5
https://www.jetbrains.com/help/clion/managing-makefile-projects.html
yum install python2-pip
pip install compeledb
File -> Settings -> Plugins
Makefile support
https://plugins.jetbrains.com/plugin/9333-makefile-support
wget https://nginx.org/download/nginx-1.16.1.tar.gz
tar -xzvf nginx-1.16.1.tar.gz
cd nginx-1.16.1
./configure
compiledb -n make
nohup ./clion.sh &
Open /root/nginx-1.16.1/compile_commands.json
File -> Settings -> Plugins
File Watchers
https://plugins.jetbrains.com/plugin/7177-file-watchers
File -> Settings -> Tools -> File Watchers -> + -> New Watcher
Name: Makefile_watcher
File type: GNU Makefile
Scope: Project Files
Program: compiledb
Arguments: -n make
Output paths to refresh: $ProjectFileDir$
Advanced Options
Auto-save...
Trigger...
Show console: Always
Level: Global
Enabled
Custom Build Targets and Applications
https://www.jetbrains.com/help/clion/custom-build-targets.html
*使用右边栏make,或者Run -> Edit Configurations...,可以自定义Makefile类型的target*
File -> Settings -> Build, Execution, Deployment -> Custom Build Targets -> +
Name: lua-5.1.5
Build: build_with_make
Program: make
Arguments: linux //根据实际情况
Working directory: $ProjectFileDir$
Clean: clean_with_make
Program: make
Arguments: clean
Working directory: $ProjectFileDir$
Run -> Edit Configurations... -> + Custom Build Appliction ->
Name: lua
Target: lua-5.1.5
Executable: lua
...
调试 nginx conf
daemon off;
master_process off;
URL
https://visualstudio.microsoft.com/zh-hans/vs/whatsnew/
https://visualstudio.microsoft.com/zh-hans/downloads/
使用C++的桌面开发
去掉
Boost.Test...
Google Test...
Live Share
C++分析工具
Windows 10 SDK...
Visual C++ ATL支持
勾选
MSVC v142 - VS 2019...
语言包
中文(简体)
英语
Empty Project
Place solution and project in the same directory
Windows 8.1 SDK
https://developer.microsoft.com/zh-cn/windows/downloads/sdk-archive/
项目类型更改
Property Pages -> Linker -> All Options -> SubSystem
字符集
Property Pages -> Advanced -> Character Set
常用快捷键
F12 (Tools -> Keyboard -> VAssisX.GotoImplementation)
Shift + F12 (Tools -> Keyboard -> VAssisX.FindReferences)
Ctrl + -
Ctrl + Shift + -
Ctrl + Shift + B
Ctrl + B
Ctrl + F5
F5
Shift + F5
F10
F11
Shift + F11
Ctrl + F10
Ctrl + Alt + P
Ctrl + K, Ctrl + F
Ctrl + K, Ctrl + C
Ctrl + K, Ctrl + U
Ctrl + R, Ctrl + R
Win+R 可以打开路径
两种窗口
1. Window
2. Debug -> Windows
1. Watch -> Watch1
2. Breakpoints
3. Memory -> Memory1
1. int a = 0x1122; //通过内存地址看其小端字节序
Win远程调试
1. 用于远程调试的程序以静态库的方式编译 Property Pages -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded Debug (/MTd)
2. 拷贝一份 C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Remote Debugger 到远程电脑
3. 以管理员身份运行 Remote Debugger\x64\msvsmon.exe
1. 关闭防火墙
2. 工具 -> 选项 -> 无身份验证 -> 允许任何用户进行调试
4. 启动要调试的程序
5. 本机VS2019 -> Ctrl + Alt + P -> Connection type: Remote(no authentication) -> Connection target: `ip:port` -> Find...
关闭SDL检查 scanf fopen
Property Pages -> C/C++ -> General -> SDL checks -> No(/sdl-)
只在windows下有效
#include <stdio.h>
int main()
{
char a = 0;
scanf("%c", &a);
//fflush(stdin);
rewind(stdin);
char b = 0;
scanf("%c", &b);
printf("a = %c, b = %c", a, b);
return 0;
}
Process Explorer
https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
Find Window's Process(drag over window)
Show Lower Pane(Ctrl+L)
C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.25.28508
支持XP
Property Pages -> General -> Platform Toolset -> Visual Studio 2015 - Windows XP (v140_xp)或更早版本
Property Pages -> Linker -> All Options -> SubSystem -> Console (/SUBSYSTEM:CONSOLE)
DebugView
OutputDebugString(L"hello 你好");
https://docs.microsoft.com/zh-cn/sysinternals/downloads/debugview
Filter
Clear
Computer -> Connect
远程电脑:
Dbgview.exe /a
fork
git clone ...
git checkout -b dev
...
git push origin dev:dev
git remote add upstream ...
git fetch upstream
git checkout master
git merge upstream/master
git push origin --delete dev
git checkout -b new_dev
https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork