【IDE-Visual Studio】fatal error C1047

    xiaoxiao2021-12-01  21

    问题

    1>------ 已启动生成: 项目: GelPrj, 配置: Release Win32 ------ 1>正在编译... 1>camera_config.cpp 1>..\functions\camera_config.cpp(1057) : warning C4018: '<' : signed/unsigned mismatch 1>正在链接... 1>fatal error C1047: The object or library file '..\temp\release\Contrast_Dye.obj' was created with an older compiler than other objects; rebuild old objects and libraries 1>LINK : fatal error LNK1257: 代码生成失败 1>正在创建浏览信息文件... 1>Microsoft ?????????? Version 8.00.50727 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>生成日志保存在“file://e:\svn4\trunk_lite\temp\Release\BuildLog.htm” 1>GelPrj - 1 个错误,1 个警告 ========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========

    原因

    有些函数写了声明没有写实现的所以出现下面的错误, 为什么编译的时候没有出现“无法解析的外部符号”的提示,可能是由于当前vs版本过高的缘故

    解决方法

    第一步、找到函数没有写实现的地方

    修改工程属性 配置属性->常规->项目默认值->MFC的使用=在静态库中使用MFC

    第二步、编译

    出现以下提示 1>正在编译资源... 1>正在链接... 1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: __strnicmp 已经在 libcmt.lib(strnicmp.obj) 中定义 1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _free 已经在 libcmt.lib(free.obj) 中定义 1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc 已经在 libcmt.lib(malloc.obj) 中定义 1>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _calloc 已经在 libcmt.lib(calloc.obj) 中定义 1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) 已经在 libcmt.lib(typinfo.obj) 中定义 1>MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) 已经在 libcmt.lib(typinfo.obj) 中定义 1>LINK : warning LNK4098: 默认库“MSVCRT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library 1>DlgCameraView.obj : error LNK2001: 无法解析的外部符号 "class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > __cdecl ccd_data_center::run(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > >,int,float)" (?run@ccd_data_center@@YA?AV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@V23@HM@Z) 1>../bin/Lane 1D.exe : fatal error LNK1120: 1 个无法解析的外部命令 1>正在创建浏览信息文件... 1>Microsoft ?????????? Version 8.00.50727 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>e:\svn4\trunk_lite\temp\release\excel.tlh(667) : BK4504 : 1>生成日志保存在“file://e:\svn4\trunk_lite\temp\Release\BuildLog.htm” 1>GelPrj - 8 个错误,13 个警告 ========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========

    第三步、找出“无法解析的外部符号”,中的关键字符并完成对应函数的实现

    如上面的错误代码所示,DlgCameraView.obj 中引用的ccd_data_center::run函数没有写实现,找到ccd_data_center::run函数声明的地方,并实现它

    第四步、将工程属性改回

    配置属性->常规->项目默认值->MFC的使用=在共享 DLL 中使用 MFC
    转载请注明原文地址: https://ju.6miu.com/read-679392.html

    最新回复(0)