简体   繁体   English

C ++:Windows 10 x64和Windows 7 x64上的MFC应用程序

[英]C++: MFC Application on both Windows 10 x64 & Windows 7 x64

I'm building MFC Application with CLR which can run on windows 10 x64 & windows 7 x64 and execute without installing Visual Studio. 我正在使用CLR构建MFC应用程序,该应用程序可以在Windows 10 x64和Windows 7 x64上运行,并且无需安装Visual Studio即可执行。 First, I've tried to find a solution for app without installing visual studio. 首先,我尝试在不安装Visual Studio的情况下找到适用于应用程序的解决方案。 After some works on google, I found some clues to this issue. 在Google上进行一些工作后,我发现了一些有关此问题的线索。 Release build doesn't require installing Visual Studio. 发布版本不需要安装Visual Studio。 I was building the project on windows 10 x64. 我在Windows 10 x64上构建项目。 So the release version can work on other windows 10 pcs without Visual Studio. 因此,发行版可以在没有Visual Studio的其他Windows 10 pc上运行。 But it can't work on Windows 7. So I've got stuck in search on this issue until now and I found something. 但是它不能在Windows 7上运行。因此直到现在,我一直在搜索这个问题上陷入困境,但发现了一些东西。 "Build applications for both Windows 7 and Windows 10 with Visual Studio 2015" is a thing I found here. 我在这里找到了“用Visual Studio 2015为Windows 7和Windows 10构建应用程序”。 The answer is right thing I've tried. 答案是我尝试过的正确方法。 On their comment, I saw one word - CMake. 在他们的评论中,我看到了一个词-CMake。 I'm not sure that I can accomplish my solution with this - CMake. 我不确定我是否可以用CMake完成我的解决方案。 Is there someone to told about this thing? 有没有人告诉这个事情? Or anyway to fix this issue? 还是要解决此问题?

Thank you. 谢谢。

CMake won't help you. CMake不会帮助您。

I think you'll need to install Visual C++ Redistributable for Visual Studio 2015 on any machine where Visual Studio was not installed, if the redistbutable package was not installed yet. 我认为,如果尚未安装可重发行软件包,则需要在未安装Visual Studio的任何计算机上安装Visual Studio 2015的Visual C ++ Redistributable

You also need to use .NET framwork which installed on both machines, I guess .NET 4 is good enough. 您还需要使用安装在两台计算机上的.NET框架,我认为.NET 4足够好。

EDIT: 编辑:

Try to run your exe from a console, and check if there is some print for missing dll or something. 尝试从控制台运行您的exe,然后检查是否有某些打印文件缺少dll或其他内容。

Anyway, you can use dependency walker to check if you're missing some dlls, (download the x64 version) drag&drop your exe into it and check what prevent it from run. 无论如何,您可以使用dependency walker来检查是否缺少某些dll(下载x64版本),将您的exe拖放到其中并检查阻止其运行的原因。

Now, I found right solution about this m own question. 现在,我找到了关于这个问题的正确解决方案。 As a matter of fact, @SHR is helpful for this answer, but there's something to modify for right solution. 实际上,@ SHR对于此答案很有帮助,但是需要为正确的解决方案进行一些修改。 Installing .NET 4.0 is right and it's mandatory for working on Windows 10 & 7 x64. 安装.NET 4.0是正确的,并且是在Windows 10和7 x64上运行所必需的。 But "Visual C++ Redistributable for Visual Studio 2015" should not be necessary. 但是,“ Visual Studio 2015可重新分发的Visual C ++”应该没有必要。 Without these packages, the app can executes on windows 7 & 10 x64. 没有这些软件包,该应用程序可以在Windows 7和10 x64上执行。 Of course, the app requires some dlls in C++ Redistributable packages. 当然,该应用程序需要C ++可再发行组件包中的某些dll。 But not all. 但不是所有的。 So I put dlls the app requires at the same directory of .exe file. 因此,我将应用程序所需的dll放在.exe文件的同一目录中。 That's all. 就这样。 There's no other requirements. 没有其他要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM