#include "stdafx.h"
#include <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/configurator.h>
#include <log4cplus/fileappender.h>
#include <log4cplus/win32debugappender.h>
#include <log4cplus/layout.h>
#include <memory>
#include <log4cplus/consoleappender.h>
#include <log4cplus/tchar.h> using namespace log4cplus;
using namespace log4cplus::helpers; int _tmain(int argc, _TCHAR* argv[])
{
log4cplus::initialize();
Logger logger = Logger::getInstance(_T("main.log"));
//std::wstring log_path = _T("d:\\test.log");
SharedObjectPtr<Appender> _append (new ConsoleAppender()); //step 1 return ;
}

error LNK2019: 无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z),该符号在函数 _wmain 中被引用
1>D:\GetFileIcon\Rand\Debug\log4cpptest.exe : fatal error LNK1120: 1 个无法解析的外部命令

由于我的导入库lib,以及动态库dll都是正确加载的,所以不是库没正确加载的问题。

分析:这是由于当前工程项目的“字符集”设置与log4plus所用的“字符集”不一致所导致的,log4cplus是使用多字节字符集,而当前工程是使用 Unicode 字符集

解决方案:打开项目属性页-常规-字符集,改成“多字节字符集”。

使用log4cplus时遇到的链接错误:无法解析的外部符号 "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,的更多相关文章

  1. 链接错误——无法解析的外部符号 ConvertStringToBST

    今天做COM组件时,编译之后,出现了一个数个编译错误:error LNK2019: 无法解析的外部符号 "wchar_t * __stdcall _com_util::ConvertStri ...

  2. 一个小错误:error LNK2019: 无法解析的外部符号 "public: __thiscall Turtle::~Turtle(void)" (??1Turtle@@QAE@XZ),该符号在函数 _main 中被引用

    昨天在撸代码的时候遇到了一个十分蛋疼的错误 : 错误: 1>3.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall Turtle::~ ...

  3. vs2010+qt4编译出现error LNK2001: 无法解析的外部符号 "public: virtual struct QMetaObject等错误

    1.当vs2010编译qt时会出现以下错误: 1>------ 已启动全部重新生成: 项目: MyDialog, 配置: Debug Win32 ------            1>生 ...

  4. 【C++】C++程序链接失败,无法解析的外部命令,无法解析的外部符号 "private: static class * Object::current"

    C++程序编译结束后,出现链接失败提示: 严重性    代码    说明    项目    文件    行    类别    禁止显示状态错误    LNK2001    无法解析的外部符号 &quo ...

  5. 错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall Distance::Distance(int)" (??0Distance@@QAE@H@Z),该符号在函数 _main 中被引用

    错误: 错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall Distance::Distance(int)" (??0Distanc ...

  6. 使用NDK r10构建Cocosd-x v3.2时编译和链接错误的解决办法

    如果你使用NDK r10构建Cocos2d-x v3.2,将会遇到所有测试用例编译错误以及Lua测试用例链接错误. 1. 编译错误 错误信息是: 1 2 3 4 5 6 7 8 /Users/ming ...

  7. VC++常见错误原因解析--error LNK2019: 无法解析的外部符号 "public: void __thiscall

    根据个人遇到这个错误时的记录,原因可以分为一下几种: 原因一: 只是在.h里面声明了某个方法, 没有在cpp里面实现 . 具体讲,有时候在头文件中声明了需要的方法,确实忘记了在源文件中实现: 有时候在 ...

  8. VS编程常见的编译和链接错误

    常见错误1: Error 2 error LNK1120: 1 unresolved externals Error 1 error LNK2019: unresolved external symb ...

  9. 静态链接和动态链接库混用导致的链接错误LINK2005

    对于一个静态链接库L.lib,它的使用者app.exe会静态链接L.lib,意思是app.exe会将L.lib中的代码(app需要的部分,例如函数定义,类的定义等等)链接到app.exe中.   而对 ...

随机推荐

  1. Java断言绝对不是鸡肋

    在防御式编程中经常会用断言(Assertion)对参数和环境做出判断,避免程序因不当的输入或错误的环境而产生逻辑异常,断言在很多语言中都存在,C.C++.Python 都有不同的断言表示形式.在Jav ...

  2. PHP中日志相关处理

    内置函数: 1.error_log() ,第三个参数不能是绝对路径,必须是相对路径.写入文件: error_log("warn:\nthis is a warn!\n",3,&qu ...

  3. 使用Github添加标签

    Github为我们提供了在页面上进行编辑发行版本的方式,如下图所示: 在Github上为项目打tag可在release页面,选择创建新tag并按下图所示填写即可.删除tag也同理.

  4. 如何清空iframe中的内容?

    我都是用这种方法往iframe里面添加内容的. document.frames["iframe1"].document.write("<img src='loadi ...

  5. 快捷切换hosts的小工具:SwitchHosts!

    Windows 绿色版本下载:http://oldj.github.io/SwitchHosts/. 日常开发工作中,我们可能经常需要切换各种 hosts 绑定,比如在本地开发时可能需要一个开发环境的 ...

  6. (原)pycharm中debugger时console如何打开

    转载请注明出处; https://www.cnblogs.com/darkknightzh/p/9913439.html 使用pycharm在debugger时,旁边的console一不小心给关了.要 ...

  7. 简单shell指令

    第一部分 简单的常用指令 1.date命令 date 2.显示日历 cal 3.显示当前目录 pwd  4.切换当前工作目录 默认情况下,超级用户的主目录是/root,而普通用户的主目录是/home下 ...

  8. Visual Studio开发工具升级注意事项

    由于前几年公司开发的系统使用的开发工具版本不统一,现在后期维护升级在开发人员的电脑上要同时安装好几个不同的开发工具, 比如VS2008,VS2010,VS2012,甚至还有用VS2003开发的接口之类 ...

  9. JS前台效果

    最新的在上面 2014年3月3日14:46:46 百分比思路 function fixWidth(percent) { return document.body.clientWidth * perce ...

  10. 如何在servlet刚启动时候获取服务器根目录?

    public class InitServlet extends HttpServlet{ public static String root; @Override public void init( ...