【问题标题】:Unable to Start Program: The system cannot find the file specified. (C++ BTW)无法启动程序:系统找不到指定的文件。 (C++ 顺便说一句)
【发布时间】:2015-06-30 18:53:13
【问题描述】:

对于代码中大量的 cmets 感到抱歉。这些要么是提醒、笔记或失败的补充,我想保留在手边,以防我最终使用它们。

我从一开始就一直在努力解决这个问题,我无能为力,也没有我在网上找到的任何东西。我的代码构建很好,100% 成功,但每次我调试/运行我的代码(这是 Visual Studio 2015 顺便说一句)我都会收到以下消息:


微软视觉工作室

无法启动程序“C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2\Debug\floatingballtry2.exe”。

系统找不到指定的文件。

文件确实在那个位置。我已经进去检查了很多次,并且在该确切位置有一个用于代码的调试 exe 文件。

感谢大家!

代码:

#include <iostream>
//#include SerialClass.h
#include 'stdafx.h'
using namespace std;
#define _USE_MATH_DEFINES
#include <math.h>

#include <stdio.h>
#include <tchar.h>
//#include "SerialClass.h"  // Library described above
#include <string>

//#include "LpmsSensorManagerI.h"
//include "LpmsSensorI.h"

using std::cout;
using std::endl;


//LpmsSensorManagerI* manager = SensorManagerFactory();

//LpmsSensorI* lpms = manager->addSensor(DEVICE_LPMS_B,'00:11:22:33:44:55');

 void main() {

     //Serial* SP = new Serial("\\\\.\\COM3");    // adjust as needed

     //a = arduino('com4', 'UNO');

    bool isspinning = true;

    int moz = 4;

    int moth = 0 ;

    int moph = 0;

    //set water release time

    while (isspinning == true) {

        //pitch = lpms->GET_PITCH();

        //yaw = lpms->GET_YAW();

        //moth += yaw;
        //moph += pitch;

        if (moth > (2 * M_PI)) {

            moth = 0;

        }

        if (moph > (2 * M_PI)) {

            moph = 0;

        }

        cout << "Radius: " + moz << endl;
        cout << "Theta: " + moth << endl;
        cout << "Phi: " + moph << endl;

        if (moth >= (M_PI / 2) - (M_PI / 8) && moth <= (M_PI / 2) + (M_PI/                                                                             
        8))                  
        {

        if (moph >= (M_PI / 2) - (M_PI / 8) && moph <= (M_PI / 2) + (M_PI /         
        8)) 
        {

                //release water

                isspinning = false;

            }

        }

        else {

            isspinning = false;

        }

    }

    cout << "Radius: " + moz << endl;
    cout << "Theta: " + moth << endl;
    cout << "Phi: " + moph << endl;

}

【问题讨论】:

  • 该消息可能是由于缺少 DLL
  • 我假设您不知道如何使用您的工具(即使您的代码 TLDR 可能有错误;)
  • 我在 Visual Studio 2010 中也遇到了同样的情况...
  • 由于这是一个简单的程序,您可能只需要从命令行编译,就可以保留 VS 的复杂性和“用户友好性”。我也更喜欢大型项目,因为我想避免供应商锁定和绑定到一个平台。
  • 是的。请参阅thisthis。正如我之前所说,我不确定这是否是问题的原因,但如果您使用预编译头文件,它必须位于其他所有内容之前。

标签: c++ visual-studio-2015


【解决方案1】:

您很可能缺少 DLL。尝试直接从 Windows 控制台运行生成的 .exe 文件,因为它经常报告缺少哪个 DLL。返回您遇到的错误。

我没有使用过 VS2005,但也许你缺少 VC++2005 Redistributable(可用here)。

【讨论】:

  • 所以,我刚打开程序就收到了这样的问候:
  • Visual C++ 为解决方案“C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2\floatingballtry2.sln”找到了一个合适的位置来存储其浏览数据库和 IntelliSense 文件。跨度>
  • Visual C++ 检查了文件夹“C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2”。由于以下原因,此文件夹不适合: \ 由于未在 C++ 高级选项中指定“后备位置”,Visual C++ 正在尝试使用您的临时目录。 Visual C++ 检查了文件夹“C:\Users\moodyg\AppData\Local\Temp\VC++\FLOATINGBALLTRY2-a27bdbad”。此文件夹适用于以下原因: 该目录位于本地驱动器上。 “回退位置”可在 C++ 高级选项下进行配置。
  • 而且,现在调试文件已经从它的文件夹中消失了
  • 您能找到.exe 并使用控制台运行它吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-04-12
  • 1970-01-01
  • 2021-08-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多