I created MFCActiveX Project in Visual Studio 2013 Pro, but I can't run this code (default) with this message:
C:\Users\JuneTaek\Desktop\MFC ActiveX control(MFCActiveX)\C++\Release\MFCActiveX.dll' can't start this program can't find designated file )
A DLL can not run without a process (EXE). So you need a hosting EXE. That is an EXE file that loads the DLL.
So you can use the Test Container, or the designated EXE where you want to use the ActiveX control.
Under the Project Settings -> Configuration Properties -> Debugging -> Command define the executable that should be launched in the debug session. This executable should later load the ActiveX control you want to debug.
Related
Trying to setup rider to execute a compiled .exe program to run with my dll. My dll is a proxy dll. I know how the compiled dll looks like and it works fine when added to the project directory.
But now I want to debug it and it needs debug configuration so that it will be pointing to external exe, which will load my dll code while running.
In Visual Studio it is done from the Configuration Properties -> Debugging screen, where you can specify the path to the exe to use in Command option.
What is the equivalent for that option in Rider?
The dll I am trying to debug is written in c++
Apparently it is .NET Executable configuraiton for C++ projects. Simply specifying the path to an external exe file and specifying working directory to be the same directory where exe (and compiled dll) is, makes it work.
I have C++ code in visual studio and an exe with pdb file, the exe is a command line utility.
I want to debug the executable. I cannot compile the source code in visual studio since it has a large no. of dependencies.
Is there a way where I can attach the debugger to debug the executable.
If it is compiled with VC++ then yes. Run your code, and attach the debugger from the menu: "Debug/Attach to process".
If you want to start the process with the debugger already attached, the follow this tutorial:
http://msdn.microsoft.com/en-us/library/0bxe8ytt.aspx.
To create an EXE project for an existing executable
On the File menu, click Open and select Project.
In the Open Project dialog box, click the drop-down list next to the File name box, and select All Project Files.
Locate the executable, and click OK.
This creates a temporary solution that contains the executable.
If yo did this, you can simply click on "Debug".
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.
I'm developing a C++ project in Visual Studio 2012 that uses driver code to interface with an open DMX box(ENTTEC DMX USB PRO). Thus far, I've been writing code and compiling as an EXE so I could use main() to run unit tests.
I want to port this over so that I have the device interface code that compiles down to a .DLL, then a separate source file that contains C++ code to compile an EXE that links to the DLL and makes calls to the functions to run the tests.
Essentially, when I go to debug, is there a way to setup Visual Studio 2012 to generate a .DLL and an .exe making calls to the .DLL and run the .exe automatically all in one step? I'm new to Visual Studio and find it quite confusing.
Yes. Setup two projects in your solution: One for your main code (generating a DLL) and one for your executable, where your unit tests reside. Then look under project dependencies (under the Project menu on VS2010, not sure about 2012) to make the EXE dependent on the DLL (that will make sure the EXE rebuilds/relinks when necessary).
Right-click on the EXE project in the Solution Explorer and select Properties. There you can setup the includes/linker to get to your header/lib file, if necessary (it might not be necessary if you use LoadLibrary explicitly or something, but I'm guessing you're not doing that).
Now in the project settings for the EXE under build events, add a post-build event that runs your tests. Note that if your EXE returns something other than 0 from main(), VS can report that as an error in the build.
I have to debug multiple dlls each within their own project. There is a parent executable that loads a dll, which serves as a container for the other dlls.
My question is how can I debug the whole 'component' ie: all the dll's involved, using Visual Studio 2005 for C++.
If they're all in the same solution, set a breakpoint in the DLL project where you want to debug, right click on the EXE project, and select Debug > Start new instance.
If they're in separate solutions, open the DLL solution, right click on the project, expand the Configuration Properties node in the tree on the left, select Debugging. Set the Command property to point to the debug build of the EXE in the other project. Then set your breakpoint(s) and hit F5 to start debugging.
Arbitrarily pick one of the DLL projects as the startup project, it doesn't matter which. Right-click + Properties, Debugging. Set the 'Command' setting to the path of a test EXE that will load the DLLs. If you don't have a good one then just write one, might as well add it to the project and make it the startup project.
Pay attention to the Output window while the EXE starts. You'll see notifications for each DLL that gets loaded. As soon as one of the DLLs that's in your solution gets loaded then the debugger jumps in, looks for the .pdb file for the DLL and activates any breakpoints you'd have set in the DLL source code. You cannot debug the DLL unless the EXE loads it.
If that still doesn't enable breakpoints then use Debug + Windows + Modules and locate the DLL in the list. Right-click it and choose Symbol Load Information to find out where the debugger looked for the .pdb file. This doesn't go wrong very often since the DLL contains the path to the .pdb file. The far more typical failure mode is that the EXE simply didn't load the DLL.