怎样设置Mac版vscode的C/C++编译环境呢?

电脑技术 电脑技术 2665 人阅读 | 11 人回复 | 2020-04-29

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

x
2016年,我病情波动的时候,买了这个Macbook Air 乞丐版,现在拿出来用了,在学c,在网上找了很多关于vscode编译环境设置教程,但是都没成功,不知道怎么搞,有人会搞吗?
人生是一部书

回答|共 11 个

simonzhd 发表于 2020-4-29 14:59:48| 字数 26 | 显示全部楼层

我在用iMac,但只会配PHP的运行环境,爱莫能助啦

james007 发表于 2020-4-29 15:51:49| 字数 64 | 显示全部楼层

simonzhd 发表于 2020-4-29 14:59
我在用iMac,但只会配PHP的运行环境,爱莫能助啦

嗯,PHP是开发网站的吗?
人生是一部书

孤独星球 发表于 2020-4-29 16:21:54| 字数 738 | 显示全部楼层


我从微软网站很快就找到这个:

https://code.visualstudio.com/docs/setup/mac


Installation
  • Download Visual Studio Code for macOS.
  • Open the browser's download list and locate the downloaded archive.
  • Select the 'magnifying glass' icon to open the archive in Finder.
  • Drag Visual Studio Code.app to the Applications folder, making it available in the macOS Launchpad.
  • Add VS Code to your Dock by right-clicking on the icon to bring up the context menu and choosing Options, Keep in Dock.


Launching from the command line
You can also run VS Code from the terminal by typing 'code' after adding it to the path:
  • Launch VS Code.
  • Open the Command Palette (F1) and type 'shell command' to find the Shell Command: Install 'code' command in PATH command.
  • Restart the terminal for the new $PATH value to take effect. You'll be able to type 'code .' in any folder to start editing files in that folder.


你可能需要翻译……
香港作家孙淡宁在《水车集》里说:“钱可以买到‘药物’,但买不到‘健康’;钱可以买到‘美食’,但买不到‘食欲’;钱可以买到‘床’,但买不到‘睡眠’……

孤独星球 发表于 2020-4-29 16:26:07| 字数 881 | 显示全部楼层

https://code.visualstudio.com/docs/cpp/config-clang-mac

In this tutorial, you configure Visual Studio Code on macOS to use the Clang/LLVM compiler and debugger.
After configuring VS Code, you will compile and debug a simple C++ program in VS Code. This tutorial does not teach you about Clang or the C++ language. For those subjects, there are many good resources available on the Web.
If you have any trouble, feel free to file an issue for this tutorial in the VS Code documentation repository.
Prerequisites
To successfully complete this tutorial, you must do the following:
  • Install Visual Studio Code on macOS.
  • Install the C++ extension for VS Code. You can install the C/C++ extension by searching for 'c++' in the Extensions view (Ctrl+Shift+X).


Ensure Clang is installed
Clang may already be installed on your Mac. To verify that it is, open a macOS Terminal window and enter the following command:
clang --version

If Clang isn't installed, enter the following command to install the command line developer tools:
xcode-select --install
香港作家孙淡宁在《水车集》里说:“钱可以买到‘药物’,但买不到‘健康’;钱可以买到‘美食’,但买不到‘食欲’;钱可以买到‘床’,但买不到‘睡眠’……

simonzhd 发表于 2020-4-29 16:47:25| 字数 40 | 显示全部楼层

james007 发表于 2020-4-29 15:51
嗯,PHP是开发网站的吗?

是的

james007 发表于 2020-4-29 18:12:34| 字数 13 | 显示全部楼层

我有谷歌翻译,谢谢孤独星球
人生是一部书

孤独星球 发表于 2020-4-29 21:17:27| 字数 51 | 显示全部楼层

james007 发表于 2020-4-29 18:12
我有谷歌翻译,谢谢孤独星球

不必客气,努力学习C语言!
香港作家孙淡宁在《水车集》里说:“钱可以买到‘药物’,但买不到‘健康’;钱可以买到‘美食’,但买不到‘食欲’;钱可以买到‘床’,但买不到‘睡眠’……

james007 发表于 2020-4-30 09:47:08| 字数 37 | 显示全部楼层

我装了个扩展插件,名字叫code runner,可以单文件调试,运行,很好用
人生是一部书

legs+ 发表于 2020-9-5 23:35:23| 字数 65 | 显示全部楼层

vscode是一个特别特别优秀的ide而且开源,但是你说用来写c我感觉你还是高估它了,它最适合写JavaScript和Python
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则