在windows下我们往往使用CB(CodeBlocksks)进行acm的编程,不用建立工程,可以直接编译并运行,然后弹出黑框框,sublime也是这样,只要MinGW搞好就行

在ubuntu下我也常常使用CB,虽然有时候会出现小问题,但是还是非常稳定的

在mac os下就比较头疼,CB是远古版本了,而且在OSX下可能闪退,但是我们总不可能使用Xcode进行C/C++代码编写吧,比较麻烦

先后配置了sublime和VSCode,最终还是选择了VSCode,比较简单好用

去微软官网下载之后拖到应用程序打开,然后下载C/C++的MS插件,然后下载codeRun(因为task的体验不好,不能编译并运行)

编译和运行其实就是一行命令行的事("g++ A.cpp -std=c++11 -o A && ./A),我们配置codeRun到这样,然后加入一些人性化操作

这个就是setting.json,可以点击查看->命令面板->找到设置

mac进行acm(C/C++)编程

 

{
    // 在终端中运行编译命令,否则我们无法与程序通过标准输入交互
    "code-runner.runInTerminal": true,
    // 运行代码之前清除之前的输出
    "code-runner.clearPreviousOutput": true,
    // 开启这个后在运行编译命令之前会自动 cd 至文件所在目录
    "code-runner.fileDirectoryAsCwd": true,
    // 这里只保留了 C 和 C++ 的编译命令,有需要其他语言的请自行添加
    "code-runner.executorMap": {
        "c": "gcc $fileName -o $fileNameWithoutExt && ./$fileNameWithoutExt",
        "cpp": "g++ $fileName -std=c++11 -o $fileNameWithoutExt && ./$fileNameWithoutExt",
    },
    // 运行代码后切换焦点至终端,方便直接输入测试数据
    "code-runner.preserveFocus": false,
    // 在运行代码之前保存文件
    "code-runner.saveFileBeforeRun": true,
    "C_Cpp.updateChannel": "Insiders",
    "editor.fontSize": 24,
    "C_Cpp.autoAddFileAssociations": false,
    "explorer.confirmDelete": false,
    "workbench.activityBar.visible": false,
    "http.proxySupport": "off",
    "workbench.sideBar.location": "left",
    "terminal.integrated.fontSize": 20,
    "editor.detectIndentation": true,
    "editor.insertSpaces": true,
    "editor.tabSize": 4,
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 10000,
    "explorer.confirmDragAndDrop": false,
    "workbench.startupEditor": "newUntitledFile",
    "workbench.editorAssociations": [
        {
            "viewType": "jupyter.notebook.ipynb",
            "filenamePattern": "*.ipynb"
        }
    ],
    "terminal.integrated.tabs.enabled": true,
    "editor.codeActionsOnSave": null,
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2021-08-30
  • 2021-11-26
  • 2021-12-18
猜你喜欢
  • 2022-02-09
  • 2021-05-21
  • 2021-12-04
  • 2022-12-23
相关资源
相似解决方案