程序“ main.exe”运行失败:指定的可执行文件不是此OS平台的有效应用程序 [英] Program 'main.exe' failed to run: The specified executable is not a valid application for this OS platform

查看:835
本文介绍了程序“ main.exe”运行失败:指定的可执行文件不是此OS平台的有效应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置Visual Studio代码,当我尝试运行main.cpp(执行时为main.exe)时,它显示了上面提到的错误。

"I’m setting up Visual Studio Code, and when I try to run my main.cpp (main.exe when executed), It is showing the error mentioned above.

根据我在网上阅读的有关该问题的信息。我认为这是因为在c_cpp_properties.json文件中写入了错误。但是我不知道在哪里进行更改。

From what I read about the issue online. I think it is because of wrong written in the c_cpp_properties.json file. But I can't figure out where to make the changes.

#Code:

#include <iostream>

int main()
{
    std::cout<<"Hello World"<<std::endl;
}

#c_cpp_properties.json :

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "${workspaceRoot}",
                    "C:\\MinGW\\lib\\gcc\\mingw32\\8.2.0\\include\\c++"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}



错误消息:



程序'main.exe'无法运行:指定的可执行文件不是此OS平台的有效应用程序。行:1 char :1
+ .\main.exe + ~~~~~~~~~~~
+ FullyQualifiedErrorId:NativeCommandFailed

Error Message:

Program 'main.exe' failed to run: The specified executable is not a valid application for this OS platform.At line:1 char:1 + .\main.exe+ ~~~~~~~~~~. + FullyQualifiedErrorId : NativeCommandFailed

推荐答案

我们可以使用

执行cpp程序

g ++ name_of_file.cpp

g++ name_of_file.cpp

./ a

或者对于c程序图


gcc name_of_file.c

gcc name_of_file.c

./ a

这篇关于程序“ main.exe”运行失败:指定的可执行文件不是此OS平台的有效应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆