I am a .NET C# developer and trying to learn C++.
I am having issues in trying to create an exe from a console app from Microsoft Visual Studio when I do a build compile and check the Debug folder. There isn't any exe, just some manifest files and other files. I am asking this because I am not sure if this is how it works? is there any another way of doing this?
I have tried the Microsoft Visual Studio console and c:\cl test.cpp, this gives me an test.exe but can it be done from the MSVS GUI like in C#?
Have you checked the debug folder at the solution level? I believe this is the default target directory. The DEBUG folder in the project is for the output of temporary build files.
Did it compile successfully ? Also, check your active configuration if its debug or Release ?
Also, check the output path to double check the location of executable.
It works the same as C#, so there is no need for command line.
Related
I'm working on a C++ dynamic library that I want to use in Unity3D, except I'm encountering an error somewhere in it and would like to debug it in visual studio. To do this, I would like to convert the VS2010 project temporarily into an .exe project. What steps would I need to follow to do this? I've already tried changing the target extension, linker output file, and set the entry point but it just won't start.
Found that I can attach the VS debugger to Unity3D process, which does what I need.
I have done a big project with Qt5 and visual Studio 2010. Everything is well inside of visual studio using the run button.
But my goal is of course to release it to other persons, without visual studio.
My problem is: I can't get the .exe run outside of visual studio. I was asked for several dll's at first, I found them all in the Qt5 bin folder.
But know I got rid of those messages, when I wan't to open my exe, nothing happens.
Just nothing.....
I cannot even find my exe in the windows task manager.
Does someone here know an answer to that issue?
There are dll files that are loaded during runtime and don't give you any error, warning or whatsoever when not present (also totally transparent to dependency walker). Such is the platforms\qwindows.dll - note that it must be in a platforms\ subfolder relative to the executable. You might also be missing libEGL.dll and libGLESv2.dll.
Dependency Walker is not very useful in this case as it shows very strange dll files missing: API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL etc.
You can use Qt5.x cmd prompt ( 5.x is the version that you are using) and run windeployqt.exe from your build directory. It will automatically find and copy all necessary dll files to your output directory.
I am using Microsoft Visual Studio 2010. When I am building my application in Debug mode, it is producing an EXE file (like it is supposed to be doing). But then (which is very surprising for me), when I change the mode from Debug to the Release mode, the compiler builds the application as a .DLL file?
I have only very recently started to use Visual Studio 2010, so don't know my way around it yet. How do I fix this so that when it is compiling in Release mode, to build the application as an .exe file ?
Set your project type to Windows Application.
In the IDE, right click on your project, and select Properties.
Configuration Properties->General->Configuration Type set to 'Application (.exe)'
In project options you should be able to choose whether you're building a .DLL or .EXE. I thought these were the same for all configurations, but you can check to see for yourself.
I am very desperate now...
I have project in Visual C++ 2010 using Qt and OpenCV. I got to phase I need to load XML file using openCV. But, I have no idea where is the working directory of my project, when run thru VS (F5). I mean, I read all config, copied desired file almost everywhere in my project folders, but it still is not seen by my EXE (OpenCV)...
What Am I doing wrong? Thanks.
right click on your project click on properties/Configuration Properties/debugging you start in whatever working directory is set to.
How can I debug a MinGW EXE with the Microsoft Visual C++ debugger?
You can attach the Visual C++ debugger to any process running on the system (from the Visual C++ menu). But for being able to step through your source code Visual C++ would have to load the symbol file (.pdb if I remember correctly) and I don't think GCC generates those files.
Exists many Visual studio extensions such us: WinGDB, VisualGDB you can find it on the web. It allows you to debug as regular Visual Studio project. These projects are not free but it has full functional 30 days trial. It has some restrictions but it's good enough.
The Problem:
GCC compiler (ie MinGW's gcc) generates debug info with "-g" flag. The debug info is embedded into the generated executable. Windows' compiler, on the other hand, uses a peculiar ".pdb" format to store the debug info. For example, Microsoft Visual Studio's debugger needs not only the executable (.exe), but also its debug info (.pdb) to be available.
The Solution:
There is a small program that can extract .pdb files from executables compiled with gcc.
It is called cv2pdb, available at https://github.com/rainers/cv2pdb.
Download cv2pdb https://github.com/rainers/cv2pdb
Put the cv2pdb.exe somewhere in your path, maybe a custom bin folder, so that it will be accessible through the command line.
Compile your file as usual using MinGW's gcc compiler, with the "-g" flag, so that the debug info is included.
Simply run cv2pdb.exe on your executable.
cv2pdb out.exe
This will generate a out.pdb file in the same directory.
(If you have Microsoft Visual Studio installed) Open the executable directly in Microsoft Visual Studio
devenv out.exe
Note: This command simply opens the executable in Microsoft Visual Studio, without creating a project for it. In effect, you can use whatever text editor + build system you want to build your executable, and then use Visual studio only as a standalone debugger.