c++ - 在 visual studio 2012 中使用 Log4cxx

标签 c++ visual-c++ linker visual-studio-2012 log4cxx

我尝试为 visual 2012 构建 log4cxx,在解决错误 4 小时后,构建成功(我不确定 :))。

作为第二步,我尝试创建一个 vs 项目来测试日志记录。 我用了this example但它一直告诉我

mainapp.cpp(2): fatal error C1083: Cannot open include file: 'log4cxx\logger.h': No such file or directory

我已经在链接器中指定了附加库目录中的目录调试路径,并添加了“log4cxx.lib”附加依赖项。

我很困惑,我不知道如何让它发挥作用

预先感谢您的帮助

最佳答案

您还需要添加 log4cxx header 所在的目录。这不是链接阶段,而是编译阶段。

这可以通过 Project Properties -> Compiler -> Preprocessor 来完成(我想,我现在没有打开 VS)

您不包含 .lib。此文件用于链接。

您需要添加到包含目录,其中包含目录log4cxx,并且该(log4cxx)目录必须包含logger.h!

关于c++ - 在 visual studio 2012 中使用 Log4cxx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13498942/

相关文章:

c - 函数名中的指针/指针函数

android - ndk r20 ld : ld: error: cannot find -lpthread

c++ - odeint : complex and higher precision types

C++ VS2010 使用命名空间并发;没有具有该名称的命名空间

c++ - 是否有可以在 Visual Studio 6 C++ 上运行的反编译器

C++ 链接 boost 库

c# - C++ DLL 将 Mat 返回给 C#

c# - DLL 加载通知

visual-studio - VS2005经常崩溃时编译

c++ - libcudart 和 gcc 的本地构建链接错误的 glibc