zoukankan      html  css  js  c++  java
  • Runtime Error R6034 Application has attempt to load the C runtime library incorrectly

    1.问题描述

    vs2015 去开发一个写入pg数据库的程序,使用libpqxx.dll,libpq.dll,这个库文件之前是用vs2008的程序中复制过来的,基于的运行时库应该是vs2008,现在开发的环境是vs2015。所以导致运行时库不匹配。编译程序成功,运行程序出现Runtime Error R6034 Application has attempt to load the C runtime library incorrectly问题,然后确定后又出现应用程序无法正常启动(0xc0000142)。请单击“确定”关闭应用程序。

     2.原因分析

    造成这种问题的原因是libpqxx.dll,libpq.dll之前是在vs2008上编译,依赖的是vs2008的运行时库。现在vs2015环境上编译,需要指定依赖运行时库。所以要用manifest文件去指定。或者重新编译libpqxx.dll文件。

    2.解决方法

    2.1方案1:使用manifest文件指定加载依赖的运行时文件

    步骤:

    (1)创建一个Microsoft.VC90.CRT.manifest文件,放入程序所在目录,文件内容如下:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable></noInheritable>
    <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    <file name="msvcr90.dll" hashalg="SHA1" hash="98e8006e0a4542e69f1a3555b927758bd76ca07d"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>+CXED+6HzJlSphyMNOn27ujadC0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcp90.dll" hashalg="SHA1" hash="3aec3be680024a46813dee891a753bd58b3f3b12"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>MyKED+9DyS+1XcMeaC0Zlw2vFZ0=</dsig:DigestValue></asmv2:hash></file> <file name="msvcm90.dll" hashalg="SHA1" hash="0195dd0896d74b62531e4f3c771904a3d996450e"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:Transforms><dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity"></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:DigestMethod><dsig:DigestValue>EeyDE7og6WoPd2oBhYbMEnpFHhY=</dsig:DigestValue></asmv2:hash></file>
    </assembly>

    (2)在配置属性--链接器--清单文件--生成清单选项设置为是。否则还是会出现(1)中的问题。

    (3)项目配置--清单工具---输入和输出---附加清单文件中输入文件的路径:$(SolutionDir)inMicrosoft.VC90.CRT.manifest,并且将嵌入清单选项设置为是。

    通过这些设置之后就可以正常编译和运行。

    2.2 方案2:重新用下载libpqxx源码文件,用vs2015的developer commond prompt for  vs2015 (在开始中找到vs2015,下面有这个工具)按照下面的流程去编译。

    提前安装pg数据库,pg数据库的位数要与库文件的位数一致,否则会出现很多未知的错误。

    https://blog.csdn.net/don211/article/details/51754869

    自己开发了一个股票智能分析软件,功能很强大,需要的点击下面的链接获取:

    https://www.cnblogs.com/bclshuai/p/11380657.html

    百度云盘下载地址:

    链接:https://pan.baidu.com/s/1swkQzCIKI3g3ObcebgpIDg

    提取码:mc8l

    微信公众号获取最新的软件和视频介绍

    QStockView

  • 相关阅读:
    IDEA使用-多线程调试
    IDEA使用-设置条件断点
    msyql定时备份数据库
    Jenkins配置详解
    Redis学习笔记
    if/else的几种优化方式
    【Linux】开放指定端口
    IDEA首次使用Git
    Navicat 快捷键使用
    IDEA远程调试Linux服务器上代码
  • 原文地址:https://www.cnblogs.com/bclshuai/p/11096418.html
Copyright © 2011-2022 走看看