Skip to content

Instantly share code, notes, and snippets.

@nufeng1999
Last active June 23, 2021 01:22
Show Gist options
  • Select an option

  • Save nufeng1999/6870e3d8385f0f7be439d9e91ee93852 to your computer and use it in GitHub Desktop.

Select an option

Save nufeng1999/6870e3d8385f0f7be439d9e91ee93852 to your computer and use it in GitHub Desktop.
[轻松搞定vscode 编译cygwin gcc 项目的配置]

1.请在 cygwin 里的/etc/profile文件的开头部位加上 export WORKDIR=$PWD ,末尾部位加上 cd $WORKDIR

因为执行类似 I:\cygwin64\bin\bash.exe --login -c "echo $PWD" 这样的命令时,工作目录才不会改变成 /home/Administrator

2.cygwin gcc 编译时可能需要配置一些环境变量等,可以在.vscode/settings.json里加上下面的配置 bash 无 --login 参数时,将执行BASH_ENV配置的文件

	"terminal.integrated.env.windows": {
		"Path":"",
        "OSTYPE":"cygwin",
        "DOT_PATH":"E:\\interpreter\\Graphviz2.38",
        "BASH_ENV":"/etc/myenv" 
	},
    "terminal.integrated.defaultProfile.windows": "Cygwin",
    "taskExplorer.pathToMake": "I:/cygwin64/bin/make.exe",
    "C_Cpp.default.compilerPath": "I:/cygwin64/bin/gcc.exe"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment