【问题标题】:Using gdcm libs in UE4在 UE4 中使用 gdcm 库
【发布时间】:2015-09-30 15:59:51
【问题描述】:

对于我的 UE4 项目,我想使用 C++ 的 GDCM 库来加载 CT 扫描。所以最近几天我真的尝试了很多,但我仍然无法使用 GDCM ......但是错误在哪里?有人可以帮我吗?

  • 我用 CMake (VS 2013 Win64) 成功创建了 dll 和 lib 文件。
  • 我把所有的库都放在了...Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Libraries
  • 我在 VolumeImport.Build.cs 中添加了 16 个库中的每一个 PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmMSFF.lib")); PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "gdcmCommon.lib")); ...
  • 我把所有的头文件都放在了Unreal Projects\VolumeImport\ThirdParty\Includes\GDCM\Includes
  • 我在项目属性中将包含路径设置为该位置。
  • 我把所有的dll都放在C:\Windows\System32

然后我使用了标题:

#include "VolumeImport.h"

#include <gdcmVersion.h>
#include <gdcmReader.h>
#include <gdcmPixmapReader.h>
#include <gdcmImageReader.h>
#include <gdcmAttributes.h>

bool CTFileLoader::Convert_DICOM()
{
    /** ... other well working code ... */

    gdcm::Trace::SetDebug(false); gdcm::Trace::SetError(true);

    gdcm::ImageReader reader;
    reader.SetFilename(files_to_process[i].c_str()); 
    if(!reader.Read()) { }

}   

我在 gdcmMediaStorage.h 中收到错误:“错误 C4515:'gdcm':命名空间使用自身。”

我尝试使用不同的包含,但这会导致不同标题中的不同错误...这些库有问题吗?但我确信它们已被添加,因为仅使用 gdcmTrace.h 和 gdcm::Trace::functions 可以正常工作。

【问题讨论】:

    标签: c++ dll unreal-engine4 .lib gdcm


    【解决方案1】:

    现在我得到了解决方案:

    • 在我的 VolumeImport.Build.cs 中,我还添加了 DLL: PublicDelayLoadDLLs.Add(Path.Combine(LibrariesPath, "gdcmMSFF.dll")); ...
    • 我更改了 gdcmMediaStorage.h 文件:注释掉“using namespace gdcm;”
    • 此外,我在使用这个大库时遇到了 dynamic_cast 问题,它需要启用 RTTI

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多