C++ Visual Studio 2010 无法启动程序 .dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12119333/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 15:54:21  来源:igfitidea点击:

visual studio 2010 unable to start program .dll

c++visual-studio-2010debuggingdll

提问by Eddie Sung

I have a problem for my visual studio 2010. When I click start debugging button and it's start debugging.

我的 Visual Studio 2010 有问题。当我单击开始调试按钮时,它开始调试。

It seems that there is no error "i just create one "button" on it "

似乎没有错误“我只是在上面创建了一个“按钮””

But it will show Unable to start program 'c:\users\.....\xx.dll'

但它会显示 Unable to start program 'c:\users\.....\xx.dll'

Does someone now how to solve it?

现在有人如何解决它?

The second question is: when I click left button to see the "Button" source code, why it will show all this project code? Should I revise some setting?

第二个问题是:当我点击左键查看“Button”源代码时,为什么会显示所有这些项目代码?我应该修改一些设置吗?

回答by Frank Thomas

Visual studio will not run a .dll by itself. does your solution have an .exe project? if so, right click it and select "Set as Startup Project". if not you will need to create one, and instruct it to load the forms within your dll.

Visual Studio 不会自行运行 .dll。您的解决方案是否有 .exe 项目?如果是这样,请右键单击它并选择“设置为启动项目”。如果没有,您将需要创建一个,并指示它在您的 dll 中加载表单。

as for left clicking the button, I'm not quite sure what you are describing. can you post a picture?

至于左键单击按钮,我不太确定您在描述什么。你能发张图片吗?

回答by Digital_Reality

In earlier versions of MSVC while running .dll, will get a dialog asking path for .exe file

在较早版本的 MSVC 中,在运行 .dll 时,会出现一个对话框,询问 .exe 文件的路径

But in MSVC 2010 and above there is no such option. To fix this

但是在 MSVC 2010 及更高版本中没有这样的选项。要解决这个问题

  1. Right click on your dll project
  2. Properties
  3. Configuration Properties > Debugging. Here, in Command -> add path to your exe.
  1. 右键单击您的 dll 项目
  2. 特性
  3. 配置属性 > 调试。在这里,在命令 -> 添加路径到您的 exe。

Add command arguments, if any.

添加命令参数(如果有)。

You are good to go!

你已准备好出发!