Where is the .exe when you compile in visual studio? - c++

I've been doing a lil program with visual studio. So far each time I debug a .exe is created in the mainfolder/debug/. But since today in that folder I find a lot of logs and a manifest and other things, but no .exe. My program still debugs correctly. What can I do?

Go to:
Properties->yourprojectname properties->Configuration properties->General->Output Directory
Put a full folder name like: C:\Users\dell\Desktop\myfolderproject\bin\debug
There will appear your exe after debugging or compiling

Related

Visual Studio 2015 can compile and run but I can't find .exe in both Release/ and Debug/

Today I code as usual. Everything seems to go well in Visual Studio 2015. It can compile and run the program successfully in VS2015. However, when I go to the Debug/ dir, I can't find .exe file, all I can see are below:
It seems that the VS2015 can't link these .obj to create a .exe file, while I have no idea how to fix it. Is there anyone who can help? Thx in advance.
You should right click on your main Visual C++ project in Visual Studio, select Properties, and check the Output Directory property on the General page. Also don't forget to check your build configuration and platform (e.g. Debug, x64) on the top of the settings page, as by the default settings those affect the output directory.
Visual C++ Project Settings Screenshot
I had the same problem. The exe is in a different "debug" folder, that is in the parent folder.
As in, when I right-click on the project in visual studio and select "show in folder", it opens source\repos<projectname><projectname> and in there is the .cpp file and a debug folder. But this is not the debug folder you are looking for.
Go to up a folder to sources\repos<projectname> theres another debug folder there that contains the exe

visual studio 2013 modify path variable when running .exe

I have compiled an exe file in Visual Studio 2013, and it depends on some external files to function. I want to keep those files in the same folder that the exe is in. When I run the .exe by clicking on it in file explorer, it loads the files fine. However, when I run it from Visual Studio, it is unable to run because the PATH variable does not include the directory with the necessary files. How can I configure my project to run the program with a modified path variable so that it can access the files properly?
As far as I understand you question correctly. I suspect that this is an issue related to the different directories when you execute. In Visual Studio (to my knowledge), you have a folder named Debug and a second folder named Release.
You may choose in Visual Studio to run the program in either debug or release mode. But you might not have the required files neccessary in both directories.
For example:
I've made a program that reads "Hello World!" from hello.txt, and displays this in the dialog window as a string.
If I store the file in the Release directory, the executable will run fine outside the IDE, when just launching the executable file.
However, if you run the application in debug mode through the IDE (Visual Studio), the program will not find the neccessary file. The program is looking for the file in it's current directory (Debug).
A quick fix to this is to copy the required files to the current working directory. Eventually have a duplicate set of files in both directories at all times.
Hope that I did understand you correct, and that my answer helps you. :)

How do I inform the debugger of the location of run-time linked DLL files?

I have a C++ program that uses the freeglut library (and hence requires the freeglut.dll at run-time. I have added the folder C:\Program Files\Common Files\freeglut\bin to my PATH environment variable.
To confirm that the location is correct, when I compile my program (debug build) and run the resulting .exe file, it works fine (the freeglut.dll file is not in the same directory as the executable).
However, when I run the program directly from the VS2012 debugger, I get this message:
The program can't start because freeglut.dll is missing from your computer. Try reinstalling the program to fix this problem.
I know that one solution is to place the freeglut.dll file in the directory of the executable. This is what I've been doing so far, but I would much rather simply inform VS2012 (or my program) of where to find the dll file. Note that this post also seems loosely related, but it doesn't seem to contain an answer relevant to what I am trying to achieve (I just want the debugger to look in the same place for DLLs as any other program!).
How do I achieve this in VS2012? Icing on the question cake would be an explanation as to why the debugger doesn't just look in the PATH variable like any other program...
You can also set project based Environment:
Open project Properties
Go to Configuration Properites -> Debugging
Enter the path in Environment, eg:
PATH=$(PATH);C:\Program Files\Common Files\freeglut\bin
Restart Visual Studio after modifying your PATH variable.
What I did actually worked. I just didn't restart VS...

Visual Studio 2012 C++ Compiled Program isn't loading files

I've got a C++ program that is exhibiting some weird behaviour when I try to run it from the IDE. One of the things this program needs to do is load some files that are in the same directory it is. I've placed these files in Visual Studio's output directory so that it can find them.
However, when I run the program from the IDE using Ctrl+F5 ( Start without debugging ), the program can't find the files it needs.
Oddly enough if I go to the Windows Explorer and manually find the generated .exe and run it, the program finds the files and runs normally.
How do I fix it so that I can run the program from the IDE and have it still find its files?
Set the "working directory" to the directory with the files. I assume you want to keep the working directory to be the same as the executable.
http://msdn.microsoft.com/en-us/library/vstudio/kcw4dzyf.aspx Outlines the settings for debugging.

Visual Studio - Run the project outside of Visual Studio

The project runs okay in the debug mode of Visual Studio, but when I tried to double-click the exe generated, it says some dll is missing. When I copied the missing dll beside the exe and double-click again, no error message dialog appeared but also nothing happened(the project has Qt-based GUI and reference some external png files).
How does Visual Studio run the exe ? How can I run the exe on my own ? Should I create a installer for the project to make it run on other computers?
you would need to either build statically or provide the required dll files.
the page at http://www.tapkaa.com/2013/05/what-dll-files-are-required-to-run-an-application-developed-with-visual-c/ tells how you can find the missing dll files.
When a process needs to load a DLL by name (without a full path to it), it will check several different places. One of those places may be the current working directory. (The details of the search path are complicated by history and security issues. You can learn the details by looking up LoadLibrary and SetDllDirectory on MSDN.)
In Visual Studio, if you look at the Properties page for the project, and click the Debugging tab, you'll see what directory is set as the working directory when you launch the program from Visual Studio. When you double click on an icon, I believe the working directory will be the directory of the executable file. If these are different, that could explain why you're able to find the DLL in one case but not in the other.
If you're calling LoadLibrary directly, the best thing to do is to always give the full path to the library. Typically, you GetModuleFileName to find out the full path for the executable, then replace the filename portion with the name of the DLL or a relative path from the executable to the DLL.
If you're failing to load an implicitly-linked DLL, then you probably need to make sure your DLL is in the same directory as the executable file.