Unable to create .exe in Visual Studio 2015 C++ with GLUT(OpenGL)

Trying to run a short piece of code from a tutorial in Visual Studio 2015. Unfortunately, every time I hit the Debug Button (F5) I receive the message

"Unable to start program C:\folder\folder\folder\folder\projectfilename.exe" ...

... where 'folder' and 'projectfilename' are stand-ins for the actual folder and filenames.

I've checked the location that the error dialogue points to and there is no .exe file present.

I've tried 'build'ing my project (by going to the 'Build' menu and selecting 'Build Solution' both as an x32 and x64 version of a debug and release build. None of these methods result in a .exe being generated, which is what the debugger appears to be looking for in order to launch the code.

Any ideas what to do?

I have followed this tutorial step-by-step but am experiencing the above error. What am I doing wrong.

Link to the Tutorial I've been following (including the exact code I'm trying to run):

http://mycodelog.com/2015/10/08/opengl-freeglut-in-visual-studio-2015/
Are any others being generated? Does Visual Studio have permissions to write to the project directory?
Running VS 2015 as Administrator so it should be able to write fine. My second tutorial project isn't writing .exe files either.
Sorry, I failed to type a complete question for the first part. I meant "Are any other errors being generated?"
That's the only error. During Debug I always receive the message in the Output window that the debug was successful.

That's immediately followed by a pop-up window that says "Unable to start program 'C:\<programroot>'. The system cannot find the file specified."
Sounds like the source file hasn't been added to the solution.
Ahh. I'm a total beginner. How do I go about doing that? Step-By-Step.
In Visual Studio with the project open shift+alt+A to open the add existing item dialog. Select the source file and click OK. The file should now show in solution explorer under Source Files.
Last edited on
I'm not totally certain what you mean by Source File. Have done some research but found no conclusive answers online. Sorry, I'm a total beginner.

Do you mean a header file, such as those referenced with the format #include <headername>?

I have followed the instructions in the linked tutorial to the letter and the error log window reports absolutely no errors, only the popup window which I described in my first post.

Not really certain what the purpose/function of a source file is and how I should identify one. Search engine results haven't shed much concise light on the subject.
A source file is a file that contains code that is compiled. For example, "main.cpp". This is in contrast to a header file, which also contains code but is compiled only indirectly when it is included in source files.
Uhh, I guess we're talking in circles then. The error occurs when I attempt to compile the project (Local Windows Debugger) by hitting F5.

Should I need to manually add the headers listed in the code in the link to a certain file, directory or part of Solution Explorer?

Trying to find out what I'm doing wrong vis-a-vis the tutorial I linked.
Try cleaning and rebuilding in case any artifacts from previous builds are causing problems. Pay special attention to linker errors with your library; if the exe isn't appearing it may be because the build is failing.

If that doesn't work, try creating a new project in a new directory and see if it fails in the same way.

If that doesn't work, I'd want to check if the library is being installed correctly. Check to make sure it is putting its binaries wherever VS is looking for them and that your headers can be found; I don't know where nuget puts that stuff.
I'm still fairly sure you are getting this error because when you try to compile the project with F5 there is no source code to compile so no executable is generated. Where are you putting the code from the tutorial?

From the project press Ctrl+Shift+A to create a new file. From the new file dialog select C++file (cpp) and paste the tutorial code into the new file then compile.
1>------ Build started: Project: OpenGL_GLUT, Configuration: Debug Win32 ------
1> Glut.cpp
1>c:\folder\folder\folder\folder\glut.cpp(27): error C2065: 'amp': undeclared identifier
1>c:\folder\folder\folder\folder\glut.cpp(27): error C2059: syntax error: ';'
1>c:\folder\folder\folder\folder\glut.cpp(27): error C2059: syntax error: ')'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I attached the .cpp file under 'Source Files' in the Solution Explorer. Errors are all found at line 27.

This wouldn't seem to make sense as the code is provided 'as is' and suggests it is working.

All I'm trying to do is learn how to run code under VS 2015. The linked site even specifies VS 2015 as the compiler.
When you copied the code from the tutorial you got an html encoded ampersand, it is in the tutorials code but shouldn't be. Your line 27 looks something like glutInit(&amp;argc, argv); when it should be glutInit(&argc, argv); just delete the amp; leaving the actual ampersand.
Success! The code now works correctly and I've learned the basics of how the VS 2015 application handles code and files.

A very heartfelt thanks to Naraku and Zhuge.
Topic archived. No new replies allowed.