Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/132.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++;-简单的hello world不';不能在vscode中工作 我刚开始用C++编程,我遇到了一个问题,可能很简单,但我已经尝试了很长时间。 Cout打印所有内置变量,但当我尝试打印字符串变量时,它不起作用(即使有其他Cout要打印的东西不是字符串,它也不会打印任何东西)_C++_Visual Studio Code_Mingw - Fatal编程技术网

C++;-简单的hello world不';不能在vscode中工作 我刚开始用C++编程,我遇到了一个问题,可能很简单,但我已经尝试了很长时间。 Cout打印所有内置变量,但当我尝试打印字符串变量时,它不起作用(即使有其他Cout要打印的东西不是字符串,它也不会打印任何东西)

C++;-简单的hello world不';不能在vscode中工作 我刚开始用C++编程,我遇到了一个问题,可能很简单,但我已经尝试了很长时间。 Cout打印所有内置变量,但当我尝试打印字符串变量时,它不起作用(即使有其他Cout要打印的东西不是字符串,它也不会打印任何东西),c++,visual-studio-code,mingw,C++,Visual Studio Code,Mingw,简而言之,当代码中有一个字符串变量时,任何东西都不起作用,至少我注意到了这一点 那没有打印任何东西 #include <iostream> #include <string> using namespace std; int main() { string greeting="hello"; cout << greeting; } #包括 #包括 使用名称空间std; int main(){ string问候语=

简而言之,当代码中有一个字符串变量时,任何东西都不起作用,至少我注意到了这一点

那没有打印任何东西

#include <iostream>
#include <string>
using namespace std;

int main() {
    string greeting="hello";
    cout << greeting;
    }
#包括
#包括
使用名称空间std;
int main(){
string问候语=“你好”;

cout解决“未找到程序入口点”等错误的方法是:

  • 列出编译器
    bin
    目录中的所有
    .dll
    s

  • 检查
    C:\Windows
    C:\Windows\System32
    并确保没有这些DLL。如果找到,请将它们移到其他地方(或删除)

  • 将编译器的
    bin
    目录添加到
    路径
    ,作为第一个条目


我应该看到完整的代码,但考虑到它不仅仅适用于
字符串
,可能您没有使用
名称空间std
: 试试这个:

#include <iostream>

using namespace std;

int main()
{
    string greeting = "Hello";

    cout << greeting;
}
#包括
使用名称空间std;
int main()
{
string问候语=“你好”;

CUTE如何构建程序?你如何运行程序?你希望输出在哪里?提示:如果你只是学习C++,使用命名空间STD 避免代码<拥抱<代码> STD::/Cord>前缀。它是有原因的。删除它将你的代码与标准库代码混淆。尝试<代码> CUT>代码> G++-O第一个第一个。.cpp
首先将源文件
first.cpp
构建到执行程序
first
,但它不运行该程序。@m88您的意思是检查编译器箱中的.dll文件是否位于
C:\Windows\System32
中,并删除这些文件,对吗?如果是,这些文件中的任何一个都在该路径中。@SamuelMolinaPerales是,从
C:\Windows\System32
中删除那些重复的DLL。没有任何重复的文件。@SamuelMolinaPerales然后继续下一步。它不起作用。我不知道我会做什么坏事……我已将它添加到问题中。
#include <iostream>

using namespace std;

int main()
{
    string greeting = "Hello";

    cout << greeting;
}