Libs,DLL和.h文件

时间:2015-04-22 09:43:48

标签: c++ visual-c++

我是一个C#家伙,这就是我迷失在这里的原因,这个项目声称为Windows编译了这个库https://soildgeo.codeplex.com/releases/view/108738

该文件夹附带Include,Lib64和Bin64文件夹。如果我没有弄错,我只需要将.lib文件复制到VC / lib文件夹,并将include文件夹中的文件夹复制到VC / include文件夹中,以便我可以开始对这些API进行编码,它们出现在#include&lt ;> intellisense然后他们不编译。我的问题是,我对这整个过程的假设是对的吗?如果不是正确的步骤?最后,我是否需要在任何时候使用Bin64文件夹中的Dll?

我正在使用VS2013 提前致谢

修改

1> ------ Build build:Project:PhysBAMTest,Configuration:Debug x64 ------ 1 GT; main.cpp中 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(163):错误C2146:语法错误:缺少&#39 ;;'在标识符' 属性'之前 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(163):错误C2530:' PhysBAM :: LOG :: anonymous-namespace'::cout' : references must be initialized 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2065: 'unused' : undeclared identifier 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163): error C2143: syntax error : missing ';' before '=' 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2146: syntax error : missing ';' before identifier '__attribute__' 1>C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(164): error C2530: 'PhysBAM::LOG::匿名 - 命名' :: CERR' :必须初始化引用 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(164):错误C2065:'未使用' :未声明的标识符 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(164):错误C4430:缺少类型说明符 - 假定为int。注意:C ++不支持default-int 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(164):错误C2374:' PhysBAM :: LOG :: anonymous-namespace'::__attribute__' : redefinition; multiple initialization 1> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\PhysBAM_Tools\Log\LOG.h(163) : see declaration of 'PhysBAM::LOG::匿名 - 命名' ::的属性' 1> C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include \ PhysBAM_Tools \ Log \ LOG.h(164):错误C2143:语法错误:缺少&#39 ;;'之前' =' ==========构建:0成功,1个失败,0个最新,0个跳过==========

修改

根据下面的答案添加WIN32宏后,我这次收到了一个链接器错误

错误1错误LNK2019:未解析的外部符号" class std :: basic_ostream> &安培; __cdecl PhysBAM :: LOG :: cout_Helper(void)" (?cout_Helper @ LOG @ PhysBAM @@ YAAEAV?$ basic_ostream @ DU?$ char_traits @ D @ std @@@ std @@ XZ)函数" void __cdecl PhysBAM :: LOG :: anonymous namespace'::动态初始化程序,用于''(无效)" (?? __ Ecout @?A0x5bbeb782 @ LOG @ PhysBAM @@ YAXXZ)C:\ Users ... \ Documents \ Visual Studio 2013 \ Projects \ PhysBAMTest \ PhysBAMTest \ main.obj PhysBAMTest

1 个答案:

答案 0 :(得分:1)

所有attributeunused__attribute__都称为GNU-ishms,即GCC兼容编译器特有的功能(GCC本身,Clang,ICC等) 。但MS VC的目标不是GCC的兼容性,所以他们不会工作。

执行Windows端口的人设法通过使用一些预编译器技巧来删除这些构造,我想在文件Utilities/PHYSBAM_OVERRIDE.h中。但对于那些工作的人,你必须定义宏WIN32。在项目中执行此操作" C / C ++预处理器设置"页面,而不是代码,因此将立即为所有源文件定义。

或者,此IMO将是正确的解决方案,修补源代码,并将#ifdef WIN32#if defined(WIN32)的每次出现替换为#ifdef _WIN32。宏_WIN32always predefined in Win32 and Win64,但WIN32不是。{/ p>

嗯,从技术上讲,如果问题是关于Windows系统或者是MSVC编译器(Windows有一个GCC编译器),那么你必须区分每个问题。然后使用_WIN32表示系统依赖项,使用_MSC_VER表示编译器依赖项。

然后,如果您愿意,请向Codeplex项目发送补丁。

<强>更新

关于链接器错误,应该很容易修复:只需添加必要的&#34; * .lib&#34;文件或文件到项目。您可以将它们添加到项目的Linker Property Page