How to know whether solution build in debug or release mode using .sln file? - visual-studio-2017

I have .sln file and I want to know whether the projects of that solution built in debug or release mode using .sln file.
Is there any way to find the mode?
Thanks in advance!

Related

Is it possible to set certain header files to be compiled under "Release" mode in Visual Studio with CMake?

Is it possible to set certain header files to be compiled under "Release" mode in Visual Studio with CMake?
Scenario:
The entire project is set up with CMake (not generating proj/sln files, pointing directly at the project's directory)
We are bringing in a header-only dependency via CMake that runs quite fast when ran in Release mode, however, it does not run as fast when ran in debug mode.
Is it possible to set this dependency to build in release mode while the rest of the application runs in Debug mode? If this is not possible are there any work arounds?
For reference I am using Visual Studio 2019 Community 16.1.6
Well, header files are not compiled, only included.
So to disable a header in debug build, the DEBUG macro should be enough:
#ifdef DEBUG
#include "problematic_header.h"
#endif
Of course, you'll also have to disable any functionality using declarations from this header.
(Posting comment to answer the question)
For anyone else that may stumble upon this, Richard is 100% right about header files not being compiled, however, i was able to get the speed I was looking for an still use the debugger by switching "Configuration Type" to "RelWithDebInfo" under CMakeSettings.json.

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

How to create Visual studio solution from make files?

I have a source code for a project with their make files. I want to create a Visual Studio (2005) solution from it. Is there any direct way to do this? can anyone help me please. I spent hours for searching, but couldn't find a way to do this.
Thanks.
Unfortunately, Microsoft removed this capability after VC++ 6.
If all you're looking to do is to build a Visual Studio project from a command line or script, you can use the devenv command to build using the settings in a project.
Something like:
devenv /build debug /project myproj myapp.sln
Ans starting with VS2010, C++ projects will use the MSBuild system, so you can drive builds using that technology.
If you really want a makefile, you'll need to write it up by hand (or maybe there's some 3rd party tool out there that I'm unaware of).
I'm not sure whether this solution can help you. Which I tried and it worked well in my previous projects. It need manually add the files.
Create a blank VS solution/project. Add the source files into that project.
Mark all source files as "Excluded from building". You can right click the files in project explorer and find the setting. So now nothing will happen when you build your project.
In project setting, find something like "Custom build step". Add the commands that invoke your original build command. (You may write different build command for debug/release ). You can also set the post-build actions such to copy your result to some folder....
Now you can edit and build source files.
For my experience, I can even debug it after setting the executable.
Hope this can help you.
If this is a one-off then it is easier to just create the VS project manually in visual studio.
If you are going to need to do this often look at ceating the project in something like cmake or Qt's .pro whcihc an generate makefiles and VS build files from the same defintion.
Do you want to use the makefile to build? You can create a project from existing source in VS 2005 and setup the project to use make to build (and the wizard will take you through all of this).
I am using VS2010.In order to build you can create a project from existing code. In VS2010 you can create project from existing code File->New->Project from Existing code. You can specify the other parameters and then ready with the solution. I did not go with make file but followed this approach which is working great.

debug DLL in a different solution

I have an *.exe project that was written in one solution under vs2005 and i have a DLL file
that the *.exe project is using.
the problem is that the dll was written in adiffrent solution and when i try to make attach
to the *.exe file (after i run it) from the dll solution in order to debug the dll , i get no symbols are loaded error (and i cant debug the dll) altough symbols were loaded (i can see the *.pdb files that created after i compiled the dll solution) .
What can I do?
First check the Output window, it will show whether or not it could find debugging symbols for the DLL when it got loaded. Next, switch to Debug + Windows + Modules, right-click your DLL and choose "Symbol load information". That shows where the debugger looked for .pdb files for the DLL. Ensure the .pdb is located in one of these paths.
If the problem is not getting source code for the DLL instead of missing .pdb files, first delete the hidden .suo file in the solution directory. The next time you debug into the DLL, Visual Studio will again prompt you to provide the path to the source code file. Don't press Escape, enter the path. Another thing you can do is right-click the solution in the Solution Explorer window, Properties, Common Properties, Debug Source Files. Add the path to the DLL source code directory.
If you have the visual studio project that generates the dll, compile it in debug configuration and launch debug. You'll be asked for an executable ; select the one you have (from your other solution) and you'll be able to debug the dll.
Now if you want to debug both at once, i believe your way is correct, as long as the dll that the exe uses is the exact one that you've just compiled in your other solution. That might be the problem you're encountering.

visual studio 2008 isn't creating an .exe file when i build my project. any ideas why?

i'm new to visual studio and couldn't find anything on google about this. i know this is an extremely noobish question, but i can't seem to find any info for it.
the debug shows me whatever i write, and the build has no errors, so i know the code i'm writing is fine.
the release folder doesn't contain the .exe, even after i build it, rebuild, clean, etc.
it's a win 32 console project. the release folder contains the .obj files, the manifest, the build log, idb, pch and pdb files (one of each)
Some possible reasons:
Did you accidentally create a class library project? In that case the output would be a DLL and not an EXE.
Does the output window or the error list display any build errors? In that case you should first fix these, then build again.
Did you change the configuration of the project, so that the output (EXE) is created in a different folder than the default one?
There's not a whole lot of reason for people to be guessing... You said you can find the build log - the exact location of any output file will be in there. To make sure you're seeing the right build log file, the output window in VS will have a link to the file that particular build run created:
1>Build log was saved at "file://c:\DevTrees\cppTest\Debug\BuildLog.htm"
1>cppTest - 0 error(s), 2 warning(s)
If you're having trouble interpreting it, post the contents.
I had the same problem; the advice above to look closely at the output window was just what I needed - thanks. My confusion was because I was looking in solution>project>Debug when VS put it in solution>Debug.
The Release and Debug folders contain outputs from different build configurations.
If you look in Project properties, you will see an Output Folder setting in the Build section, and it will be different for each configuration. (You can see the setting for each configuration using the dropdown list at the top of the Project Properties window)
The Release folder will only get populated when you build the project in the Release configuration.
To switch to the Release configuration, use the dropdown list in the toolbar.
EDIT: I am describing the UI for C# projects. It may be different for native code.
Are you sure that your project type is correct? A class library project won't build an executable. It would need to be some sort of application project to create an executable.
I had the same problem. The compilation went fine, but no .exe was generated in the target folder (.\Debug).
The problem was actually that the file containing the main() function was called "FooProject.cpp". I renamed it to "main.cpp" and then the .exe was generated properly.
In other IDEs such as Eclipse CDT, you don't need to have your main file called "main.cpp" as long as you have a proper main() function. This is apparently not the case for Visual C++.