Access denied running program in Visual Studio

In Visual Studio, open up the project properties dialog (right click on the project in the solution explorer pane and choose properties). Go to Debug and see what the command line to run the app is. That is most likely what is wrong.


CMake uses the same configuration as the one you are used on Linux. The common structure for simple projects is to have the sources files, compiled files and executable in same directory. So you can compile and run from the same directory.

MSVC default configuration (I do not know how to change that, and I would not dare to) uses one folder per configuration. You can have as many as them as you want, common ones would be DebugUnicode, ReleaseUnicode, DebugAnsi and ReleaseAnsi.

The common structure is :

  • top level folder : solution
    • one folder per project in the solution (one solution can contain multiple projects) : source files
      • a res folder (optional) for resource files (icons, etc.)
      • a folder per configuration, Debug + Release : object and executable files

So it is by design that executable files are not in same folder as the solution. You can execute them from there by giving their relative path: Debug\project.exe


In Visual Studio, right-click your project and mark it as 'Set as Startup project'.