none
VC++ application run on windows 10 but doesn't on windows 7 RRS feed

  • Question

  • 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. 

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

    1. VCRUNTIME140D.dll is missing
    2. UCRTBASED.dll is missing

    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: 

    • the path is not of a legal form. 

    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);

    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. 

    • Moved by Stanly Fan Friday, March 2, 2018 1:04 AM
    Monday, February 5, 2018 5:26 PM

All replies

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

    1. VCRUNTIME140D.dll is missing
    2. UCRTBASED.dll is missing
    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.


    Sam Hobbs
    SimpleSamples.Info

    • Proposed as answer by Stanly Fan Tuesday, February 6, 2018 1:44 AM
    • Unproposed as answer by Stanly Fan Monday, February 26, 2018 2:21 AM
    • Proposed as answer by Stanly Fan Monday, February 26, 2018 2:21 AM
    Monday, February 5, 2018 9:01 PM