首页 > 编程语言 >vscode+cmake c++ hello world!

vscode+cmake c++ hello world!

时间:2023-06-16 14:25:12浏览次数:45  
标签:cmake vscode c++ https world main hello

1. 新建一个测试目录hello及一些必要文件

D:\HELLO\HELLOCPP
│  CMakeLists.txt
└─ main.cpp

CMakeLists.txt

# 工程名
project(Hello)
# 生成目标
add_executable(Hello main.cpp)

hello.cpp

#include <iostream>
using namespace std;

int main() {
    cout << "hello world!" << endl;
    return 0;
}

2. 配置工程configure,选一个自己喜欢的配置开始配置

image
image

3. 点击底栏的运行按钮运行程序

image

vscode插件依赖

image

参考

cmake安装 https://cmake.org/download/
vc++安装 https://visualstudio.microsoft.com/zh-hans/vs/community/
vscode安装 https://code.visualstudio.com/download

标签:cmake,vscode,c++,https,world,main,hello
From: https://www.cnblogs.com/BuzzWeek/p/17485369.html

相关文章

  • char *p = "world";
    intmain(intargc,char*argv[]){ { char*p="world";//没错。 //p[1]='a';//运行报错 printf(p); p="hello"; printf(p); } { charp[]="world";//可以p[i]='X' p[1]='a'; printf(p);// p=......
  • CMake命令行添加编译参数
    CMake命令行添加编译参数学习自coroserver例程:https://github.com/windoze/coroservercoroserver是一个应用Boost.Asio和Boost.Coroutine的多线程TCP服务器。README中有编译命令行示例:`CXXFLAGS="-std=c++11-stdlib=libc++"LDFLAGS="-stdlib=libc++"cmake[options]pa......
  • CMake添加-D_DEBUG宏
    Linux下Debug版不会自动添加_DEBUG宏,只有NDEBUG宏可用。cmake../src_DCMAKE_BUILD_TYPE=Debug-D_DEBUG会报错:-D_DEBUGshouldbe:VAR:type=value需要-D_DEBUG=1.改为在CMakeLists.txt中添加:if(CMAKE_BUILD_TYPESTREQUALDebug)add_definitions(-D_DEBUG......
  • Docusaurus之markdown文档的vscode代码片段
    需求我是使用Docusaurus建立的个人站点,在写文档是总是要在开头配置作者、日期等等,用过Docusaurus的都应该知道。因为每次新建一个md文档都需要重新配置,很麻烦,于是我就想能不能新建一个用户代码片段(vscode的一个功能),每次我只需要敲几个字符,按回车就能得到一个模板,以至于每次写mar......
  • VScode配置C语言环境
    0.前言运行系统为【Windows11专业版】1.安装VScode 官网下载 VScode或使用电脑自带【MicrosoftStore】(微软商店)下载。2.运行配置VScode3.安装编译器(MinGW-W64GCC)下载地址官网:MinGW-w64蓝奏云:https://hyborn.lanzouw.com/iqb1x0i0wwjc密码:0000下载完成后把压缩......
  • VSCode - Replace Tab with 4 Spaces for Go
    Checkbelowsettings:Ifgotbelowerrormessage,justrunthecommand:The"goformat"commandisnotavailable.Run"goinstall-vwinterdrache.de/goformat/[email protected]"toinstall. Openafile,cl......
  • 构建简单CMake及vscode调试
    main.cpp#include<iostream>intmain(){intnum_a,num_b;num_a=10;num_b=20;std::cout<<"num_a="<<num_a<<std::endl;std::cout<<"num_b="<<num_b<<std......
  • VSCode - Replace Tab with Spaces
    PressF1.Input'indentationtospaces'.SetaKeyBindingtothecommand'ConvertIndentationtoSpaces':Exitandre-openVSCodetomakethesettingtakeeffect.......
  • Cmake 基础教程
    介绍CMake是个一个开源的跨平台自动化建构系统,用来管理软件建置的程序,并不依赖于某特定编译器,并可支持多层目录、多个应用程序与多个库。它用配置文件控制建构过程(buildprocess)的方式和Unix的make相似,只是CMake的配置文件取名为CMakeLists.txt。CMake并不直接建构出最终的软件,......
  • Log in Leetcode in Vscode With Cookies" #标题
    Installleetcodeplug-ininvscodeIt'seasybysearchinExtension.LoginwithcookiesIfyouwanttologinleetcodeinvscodeleetcodeplug-inbygithubaccount,theremaybebugsthatyoucan'ttestorsubmit.Butifyousigninwithcookies......