VC ++应用程序在Windows 10上运行,但在Windows 7上不运行 [英] VC++ application run on windows 10 but doesn't on windows 7

查看:345
本文介绍了VC ++应用程序在Windows 10上运行,但在Windows 7上不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello< g class =" gr_ gr_129 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Style multiReplace"数据-GR-ID =" 129" id =" 129"> Guys,< / g>



我最近一直在使用目标.NET framework 4.6.2开发vc ++ / cli项目,目标平台8.1和Visual Studio 2017.该项目依赖于内置到.dll文件中的外部库,并添加到项目的
发布文件中。该项目在我的笔记本电脑上结束,它完美运行没有任何问题。我使用可视化安装程序生成安装文件以在其他计算机上安装项目。 
$

Hello <g class="gr_ gr_129 gr-alert gr_gramm gr_inline_cards gr_disable_anim_appear Style multiReplace" data-gr-id="129" id="129">Guys ,</g>

I have been recently working on a vc++/cli project with target .NET framework 4.6.2, with target platform 8.1 and visual studio 2017. The project is dependent on external libraries that are built into .dll files and added to the release file of the project. The project came to an end on my laptop, it runs perfectly without any problems. I used the visual installer to produce an installation file to install the project on other computers. 

然而,在Windows 7 PC上安装项目后我出现以下错误: 

However, after installing the project on windows 7 PC I got the following errors: 


  1. 缺少VCRUNTIME140D.dll
  2. 缺少UCRTBASED.dll

我通过将丢失的.dll复制到System32解决了错误1,并通过将ucrtbased.dll添加到我的应用程序的release文件夹中解决了错误2.  



当我运行我的应用程序时,执行main方法但是当创建我的主表单类的实例时它崩溃并且< g class =" gr_ gr_3091 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 3091" ID = QUOT; 3091">返回< / g取代;
以下错误消息: 

I solved error 1 by copying the missing .dll to System32 and error 2 was solved by adding ucrtbased.dll to the release folder of my application.  

When I run my application the main method is executed however when creating an instance of my main form class it crashes and <g class="gr_ gr_3091 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="3091" id="3091">return</g> the following error messages: 


  • 路径不是合法格式。 

我检查了任务管理器,看到应用程序在后台运行,但GUI表单没有显示。

I checked the task manager and saw that the application is running in the background but the GUI form is not shown.

我的主表单运行程序的代码可以在下面的代码块:

the code for my main form runner is found in the below code block:

#include "mainForm.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>
#include <string>
#include <sstream>
#include <cstdlib>
#include <cassert>
#include <stdlib.h>
#include <cassert>
#include <time.h>
#include <stdio.h>
#include "commonClass.h"
#include "commonClass2d.h"
//#include "gnuplot-iostream-master\gnuplot-iostream.h"

using namespace System;
using namespace System::Windows::Forms;
using namespace System::Runtime::InteropServices;
using namespace System::Text::RegularExpressions;
[System::STAThread]


int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine, int nCmdShow){

	std::stringstream ss;
	ss << GetCommandLineA();	
	std::string a = ss.str();
	System::String^ toReturn = gcnew System::String(a.c_str());		
	MatchCollection  ^ tempMatch = Regex::Matches(toReturn, "\"(.*?)\"", RegexOptions::IgnoreCase);
	if (tempMatch->Count > 1)
	{
		Match ^ firstMatch = tempMatch[1];
		toReturn = firstMatch->Value;
		
	
	}
	else toReturn = "";
	try {		
		RheologyVariables   rheolog;		
		commonClass ^ common;		
		Mesh1d mesh(rheolog);		
		Mesh2d mesh2d(rheolog);		
		mesh.initParameters();	
		mesh2d.initParameters();	
		commonClass2d^ common2d = gcnew commonClass2d(mesh2d);	
		common = gcnew commonClass(mesh, common2d);
		Application::EnableVisualStyles();
		Application::SetCompatibleTextRenderingDefault(false);		
		ThermoDynamics::mainForm form(common, rheolog, toReturn); <== Error is thrown here	
		Application::Run(%form);
		return 0;
	}
	catch (Exception ^  e)
	{
		MessageBox::Show(e->StackTrace, "Error", MessageBoxButtons::OK,MessageBoxIcon::Error);		

	}
		throw e;
	}
	
}

以下声明引发错误:  ;

The error is thrown at the following statement: 

ThermoDynamics::mainForm form(common, rheolog, toReturn);

注意:请注意两者vc ++ redistrubted< g class =" gr_ gr_38 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 38" id =" 38"> package< / g> 与
一起安装< g class =" gr_ gr_3058 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace"数据-GR-ID =" 3058" id =" 3058">< g class =" gr_ gr_3053 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del"
data-gr-id =" 3053" ID = QUOT; 3053">的< / g取代; 。< / g> Net framework< g class =" gr_ gr_3060 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace"数据-GR-ID =" 3060" ID = QUOT; 3060">之前< / g取代;
运行该应用程序。 

Note: Please note that both vc++redistrubted <g class="gr_ gr_38 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="38" id="38">package</g> is installed alongside with <g class="gr_ gr_3058 gr-alert gr_gramm gr_inline_cards gr_run_anim Style multiReplace" data-gr-id="3058" id="3058"><g class="gr_ gr_3053 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del" data-gr-id="3053" id="3053">the</g> .</g>Net framework <g class="gr_ gr_3060 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace" data-gr-id="3060" id="3060">before</g> running the application. 

推荐答案


但是,在Windows 7 PC上安装项目后,我收到以下错误: 

However, after installing the project on windows 7 PC I got the following errors: 


  1. 缺少VCRUNTIME140D.dll
  2. 缺少UCRTBASED.dll



这些是调试版本。它们不打算重新分发。您需要进行发布构建并从中进行设置。修复然后再试一次。您应该删除您复制的任何调试DLL。

Those are debug versions. They are not intended to be redistributed. You need to make a release build and make a setup from that. Fix that then try again. You should remove any of th4e debug DLLs that you copied.


这篇关于VC ++应用程序在Windows 10上运行,但在Windows 7上不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆