0

Sorry for the copious amounts of comments in the code. Those are either reminders, notes or failed additions that I want to keep on hand in case I end up using them.

I have been struggling with this issue since the beginning, and nothing I can do, nor anything I find online has worked. My code build's fine, with a 100% success, but every time I debug / run my code (This is visual studio 2015 btw) I get this message:


Microsoft Visual Studio

Unable to start program 'C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2\Debug\floatingballtry2.exe'.

The system cannot find the file specified.

The file is indeed in that location. I have gone in and checked numerous times, and there is a debug exe file for the code in that exact location.

Thanks to any and all!

Code:

#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;

}
syrixces
  • 1
  • 1
  • 1
  • The message may be due to a missing DLL – marom Jun 30 '15 at 18:54
  • I assume you do not know how to use your tools (even you might have an error in the code TLDR;) –  Jun 30 '15 at 18:59
  • Same Happened To Me In Visual Studio 2010... – marc_s Jun 30 '15 at 19:02
  • Since this is a simple program you might just compile from the command line, leaving VS complexity and "user friendlyness" for what it is. I prefer that also for big projects, since I want to avoid vendor lock-in and being tied to one platform. – Jacques de Hooge Jun 30 '15 at 19:03
  • Maybe not related.. but try `#include 'stdafx.h'` on the first line of code – hlscalon Jun 30 '15 at 19:03
  • Would that make a difference form the third line? Does it have to be first? – syrixces Jun 30 '15 at 19:21
  • 1
    Yes. See [this](http://stackoverflow.com/questions/9291485/visual-c-not-allowing-iostream), [this](http://stackoverflow.com/questions/2976035/purpose-of-stdafx-h). As I said before, I am not sure this is the cause of the problem, but if you use a precompiled header it must come before everything else. – hlscalon Jun 30 '15 at 19:40

1 Answers1

0

You're very likely missing a DLL. Try running the generated .exe file straight from windows console, as it often reports which DLL is missing. Come back with the error you're getting.

I haven't used VS2005, but maybe you're missing the VC++2005 Redistributable (available here).

Blito
  • 328
  • 2
  • 9
  • So, I just opened up the program and was greeted with this: – syrixces Jun 30 '15 at 19:19
  • Visual C++ found a suitable location to store its browsing database and IntelliSense files for the solution "C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2\floatingballtry2.sln." – syrixces Jun 30 '15 at 19:19
  • Visual C++ examined the folder "C:\Users\moodyg\Documents\Visual Studio 2015\Projects\floatingballtry2." This folder is not suitable because of the following: \ Because a 'Fallback Location' was not specified in the C++ Advanced Options, Visual C++ is attempting to use your temporary directory. Visual C++ examined the folder "C:\Users\moodyg\AppData\Local\Temp\VC++\FLOATINGBALLTRY2-a27bdbad." This folder is suitable because of the following: The directory is on a local drive. The 'Fallback Location' is configurable under C++ Advanced Options. – syrixces Jun 30 '15 at 19:19
  • and, now the debug file has disappeared from it's folder – syrixces Jun 30 '15 at 19:20
  • Were you able to find the `.exe` and run it using the console? – Blito Jun 30 '15 at 19:37
  • No, that's the thing, it disappeared. It used to be in the debug file, then, the above message displayed, and it disappeared. – syrixces Jun 30 '15 at 19:53