小编Toà*_*yễn的帖子

如何在 Visual Studio Code 中创建自定义项目模板

如何在 VS Code 中为新项目创建模板,以便每次从模板创建新项目时,都会自动为我创建每个文件和文件内容。例如,我希望 VS Code 使我的新项目包含一个包含以下内容的 Makefile 文件:

console: main 
    ./main

file: main 
    ./main < input.txt > output.txt
    
main: main.cpp 
    g++ -g -O2 -std=gnu++17 -static main.cpp -o main
Run Code Online (Sandbox Code Playgroud)

连同3个文件,分别是main.cpp、input.txt和output.txt。

c++ templates visual-studio-code

5
推荐指数
1
解决办法
6044
查看次数

C++ 的高级打印函数

有没有办法在 C++ 中创建一个可以像 Python 一样使用的函数或宏?我的意思是一个函数,如:

print(i); // i is an integer.
print(i, s); // i is an integer, s is a std::string. They are separated by a white space.
Run Code Online (Sandbox Code Playgroud)

一个接受多个参数的函数,然后不管类型如何都将它们打印出来。

c++

2
推荐指数
3
解决办法
177
查看次数

标签 统计

c++ ×2

templates ×1

visual-studio-code ×1