小编Yul*_* Ao的帖子

使用VSCode在Python中调试期间读取输入

这是我在vs代码中使用的python扩展:python扩展.

当我使用扩展程序提供的调试功能时,如果需要从命令行输入,它将挂在那里并且什么也不做.

在哪里可以输入值来跨越vs代码中的输入语句?

python visual-studio-code

12
推荐指数
2
解决办法
1万
查看次数

为什么隐式类型转换在模板推导中不起作用?

在下面的代码中,我想通过隐式转换intScalar<int>对象来调用模板函数.

#include<iostream>
using namespace std;

template<typename Dtype>
class Scalar{
public:
  Scalar(Dtype v) : value_(v){}
private:
  Dtype value_;
};

template<typename Dtype>
void func(int a, Scalar<Dtype> b){ 
  cout << "ok" <<endl;
}

int main(){
  int a = 1;
  func(a, 2); 
  //int b = 2;
  //func(a, b);
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

为什么模板参数推导/替换失败?评论代码也是错误的.

test.cpp: In function ‘int main()’:
test.cpp:19:12: error: no matching function for call to ‘func(int&, int)’
   func(a, 2);
            ^
test.cpp:19:12: note: candidate is:
test.cpp:13:6: note: template<class Dtype> void func(int, …
Run Code Online (Sandbox Code Playgroud)

c++ templates c++11

12
推荐指数
1
解决办法
607
查看次数

makefile 中带反斜杠的多行配方和不带反斜杠的多行配方之间的区别

在makefile中,有什么区别

targets : prerequisites
        recipe command \
        recipe command \
        ...
Run Code Online (Sandbox Code Playgroud)

targets : prerequisites
        recipe command
        recipe-command
        ...
Run Code Online (Sandbox Code Playgroud)

c makefile

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

windows上如何使用cl.exe定义task.json来编译vscode中的C/C++代码?

我已经在我的 64 位 win10 上安装了 Microsoft Visual C++ Build Tools 2015,并且可以使用 cl.exe 通过以下步骤在普通命令提示符窗口中编译和链接 C/C++ 程序(一些说明来自设置路径和环境命令行构建的变量):

 1. cd "\Program Files (x86)\Microsoft Visual Studio 14.0\VC"
 2. vcvarsall amd64
 3. cl helloworld.c
Run Code Online (Sandbox Code Playgroud)

helloworld.c 只是一个简单的 C 源文件,用于打印“Hello world!”。我也尝试配置task.json,直接在vs代码中编译链接C/C++程序。这是我的 task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "command": "vcvarsall amd64 && cl",
    "isShellCommand": true,
    "args": ["${file}"],
    "showOutput": "always"
}
Run Code Online (Sandbox Code Playgroud)

和路径vsvarsall,并cl已在PATH被添加。但它仍然不起作用(输出放在帖子的末尾)。所以我的问题是:如何定义 task.json ,它可以先运行vcvarsall amd64以设置系统变量,然后执行cl命令来编译和链接程序。

在此处输入图片说明

c c++ windows visual-studio-code vscode-tasks

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