赞
踩
概述:咱们都知道,在linux上编写大型c和c++代码,可能需要CLion和桌面。安装桌面我也有讲过:VirtualBox的Centos上安装GNOME桌面完整教程-CSDN博客
当然我这边自然是不推荐使用安装桌面这种方式。
Visual Studio Code - Code Editing. Redefined
下载并解压成功即可。
c和c++提醒的东西要提前安装哦。
安装我标记的插件:
编写自己的ip地址:
连接即可。
一定要在连接之后配置。
然后再给自己的虚拟机安装llvm和clang
- yum install llvm 加版本号
- yum install clang 加版本号
我没有加版本号,所以下载的都是老的东西,然后后面还要手动去搞,当然你们也可以像我一样不加版本号。
配置一下配置文件。
launch.json文件:
- {
- // 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": [
- {
- "type": "lldb",
- "request": "launch",
- "name": "Debug",
- "program": "${workspaceFolder}/CppTest/${fileBasenameNoExtension}",
- "args": [],
- "cwd": "${workspaceFolder}",
- "preLaunchTask": "Build C++",
- "internalConsoleOptions": "neverOpen",
- "console": "integratedTerminal"
- }
- ]
- }

tasks.json文件:
- {
- "version": "2.0.0",
- "tasks": [
- {
- "type": "shell",
- "label": "Build C++",
- "command": "clang++",
- "args": [
- "-g",
- "-Wall",
- "-o",
- "${workspaceFolder}/CppTest/${fileBasenameNoExtension}",
- "${file}"
- ],
- "group": {
- "kind": "build",
- "isDefault": true
- },
- "detail": "Task generated by Debugger."
- }
- ]
- }

因为我说了,我下载的是老版本的,到最后debug是注定失败的,所以这里要升级一下
- 1、下载文件
- 下载地址:https://mirrors.tuna.tsinghua.edu.cn/gnu/glibc/glibc-2.18.tar.gz
-
- 2、安装部署
- 解压
- tar -zxvf glibc-2.18.tar.gz
-
- 创建编译目录
- cd glibc-2.18
- mkdir build
-
- 编译、安装
- cd build/
- ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
-
- make -j 8
- make install

代码:
- #include "stdio.h"
- int main(){
- int a=1,b;
- scanf("%2d%2d",&a,&b);
- printf("%d %d\n",a,b);
- return 0;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。