Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/151.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C++;macos项目 我正在研究一个小型C++项目,需要从DICOM标签中提取信息。 我使用VSCode来管理C++代码和CMake来构建.< /P>_C++_Macos_Visual Studio Code_Dcmtk - Fatal编程技术网

如何在C++;macos项目 我正在研究一个小型C++项目,需要从DICOM标签中提取信息。 我使用VSCode来管理C++代码和CMake来构建.< /P>

如何在C++;macos项目 我正在研究一个小型C++项目,需要从DICOM标签中提取信息。 我使用VSCode来管理C++代码和CMake来构建.< /P>,c++,macos,visual-studio-code,dcmtk,C++,Macos,Visual Studio Code,Dcmtk,通过Macport安装DCMTK:端口安装DCMTK 如何将DCMTK作为库添加到我的项目中?有没有一步一步的教程 谢谢 更新: 以下是我根据@mattdibi所做的 在my CMakeLists.txt中添加了以下行 find_package(DCMTK REQUIRED) include_directories(${DCMTK_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} tinyxml2 ${DCMTK_LIBRARIES})

通过Macport安装DCMTK:端口安装DCMTK

如何将DCMTK作为库添加到我的项目中?有没有一步一步的教程

谢谢

更新: 以下是我根据@mattdibi所做的

在my CMakeLists.txt中添加了以下行

find_package(DCMTK REQUIRED)
include_directories(${DCMTK_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} tinyxml2 ${DCMTK_LIBRARIES})
然后将include path“/opt/local/include”添加到文件c_cpp_properties.json中的“includePath”部分

将包含行添加到我的源文件:

#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmimgle/dcmimage.h"
cd到项目根目录中的我的调试文件夹,运行cmake-DCMAKE\u BUILD\u TYPE=Debug

最后,在调试文件夹下运行make,以下是包含错误的生成日志:

[ 50%] Built target tinyxml2
[ 75%] Building CXX object CMakeFiles/SURMaker.dir/MakerApp.cpp.o
In file included from /Users/adminuser/Documents/Playground/SURMaker/MakerApp.cpp:5:
In file included from /opt/local/include/dcmtk/dcmdata/dctk.h:28:
In file included from /opt/local/include/dcmtk/dcmdata/dctypes.h:27:
In file included from /opt/local/include/dcmtk/oflog/oflog.h:32:
In file included from /opt/local/include/dcmtk/ofstd/ofconapp.h:29:
In file included from /opt/local/include/dcmtk/ofstd/ofcmdln.h:32:
In file included from /opt/local/include/dcmtk/ofstd/offile.h:30:
In file included from /opt/local/include/dcmtk/ofstd/ofstd.h:33:
In file included from /opt/local/include/dcmtk/ofstd/oflimits.h:88:
In file included from /opt/local/include/dcmtk/ofstd/ofstdinc.h:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace; did you
      mean 'sigwait'?
using ::signbit;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:101:5: note: 'sigwait' declared here
int     sigwait(const sigset_t * __restrict, int * __restrict) __DARWIN_ALIAS_C(sigwait);
        ^
In file included from /Users/adminuser/Documents/Playground/SURMaker/MakerApp.cpp:5:
In file included from /opt/local/include/dcmtk/dcmdata/dctk.h:28:
In file included from /opt/local/include/dcmtk/dcmdata/dctypes.h:27:
In file included from /opt/local/include/dcmtk/oflog/oflog.h:32:
In file included from /opt/local/include/dcmtk/ofstd/ofconapp.h:29:
In file included from /opt/local/include/dcmtk/ofstd/ofcmdln.h:32:
In file included from /opt/local/include/dcmtk/ofstd/offile.h:30:
In file included from /opt/local/include/dcmtk/ofstd/ofstd.h:33:
In file included from /opt/local/include/dcmtk/ofstd/oflimits.h:88:
In file included from /opt/local/include/dcmtk/ofstd/ofstdinc.h:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9: error: no member named 'isfinite' in the global namespace; did you
      mean 'finite'?
using ::isfinite;
      ~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
           ^
In file included from /Users/adminuser/Documents/Playground/SURMaker/MakerApp.cpp:5:
In file included from /opt/local/include/dcmtk/dcmdata/dctk.h:28:
In file included from /opt/local/include/dcmtk/dcmdata/dctypes.h:27:
In file included from /opt/local/include/dcmtk/oflog/oflog.h:32:
In file included from /opt/local/include/dcmtk/ofstd/ofconapp.h:29:
In file included from /opt/local/include/dcmtk/ofstd/ofcmdln.h:32:
In file included from /opt/local/include/dcmtk/ofstd/offile.h:30:
In file included from /opt/local/include/dcmtk/ofstd/ofstd.h:33:
In file included from /opt/local/include/dcmtk/ofstd/oflimits.h:88:
In file included from /opt/local/include/dcmtk/ofstd/ofstdinc.h:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:316:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:317:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:318:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:319:7: error: no member named 'isgreater' in the global namespace; did you
      mean '::std::greater'?
using ::isgreater;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:720:29: note: '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from /Users/adminuser/Documents/Playground/SURMaker/MakerApp.cpp:5:
In file included from /opt/local/include/dcmtk/dcmdata/dctk.h:28:
In file included from /opt/local/include/dcmtk/dcmdata/dctypes.h:27:
In file included from /opt/local/include/dcmtk/oflog/oflog.h:32:
In file included from /opt/local/include/dcmtk/ofstd/ofconapp.h:29:
In file included from /opt/local/include/dcmtk/ofstd/ofcmdln.h:32:
In file included from /opt/local/include/dcmtk/ofstd/offile.h:30:
In file included from /opt/local/include/dcmtk/ofstd/ofstd.h:33:
In file included from /opt/local/include/dcmtk/ofstd/oflimits.h:88:
In file included from /opt/local/include/dcmtk/ofstd/ofstdinc.h:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:320:7: error: no member named 'isgreaterequal' in the global namespace;
      did you mean '::std::greater_equal'?
using ::isgreaterequal;
      ^~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/functional:749:29: note: '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from /Users/adminuser/Documents/Playground/SURMaker/MakerApp.cpp:5:
In file included from /opt/local/include/dcmtk/dcmdata/dctk.h:28:
In file included from /opt/local/include/dcmtk/dcmdata/dctypes.h:27:
In file included from /opt/local/include/dcmtk/oflog/oflog.h:32:
In file included from /opt/local/include/dcmtk/ofstd/ofconapp.h:29:
In file included from /opt/local/include/dcmtk/ofstd/ofcmdln.h:32:
In file included from /opt/local/include/dcmtk/ofstd/offile.h:30:
In file included from /opt/local/include/dcmtk/ofstd/ofstd.h:33:
In file included from /opt/local/include/dcmtk/ofstd/oflimits.h:88:
In file included from /opt/local/include/dcmtk/ofstd/ofstdinc.h:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:321:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:322:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:323:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:324:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
13 errors generated.
make[2]: *** [CMakeFiles/SURMaker.dir/MakerApp.cpp.o] Error 1
make[1]: *** [CMakeFiles/SURMaker.dir/all] Error 2
make: *** [all] Error 2
[50%]构建目标tinyxml2
[75%]构建CXX对象CMakeFiles/SURMaker.dir/MakerApp.cpp.o
在/Users/adminuser/Documents/playway/SURMaker/MakerApp.cpp中包含的文件中:5:
在/opt/local/include/dcmtk/dcmdata/dctk.h中包含的文件中:28:
在/opt/local/include/dcmtk/dcmdata/dctypes.h:27中包含的文件中:
在/opt/local/include/dcmtk/oflog/oflog.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofstd/ofcanpp.h中包含的文件中:29:
在/opt/local/include/dcmtk/ofstd/ofcmdln.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofsd/offile.h中包含的文件中:30:
在/opt/local/include/dcmtk/ofstd/ofstd.h中包含的文件中:33:
在/opt/local/include/dcmtk/ofsd/oflimits.h:88中包含的文件中:
在/opt/local/include/dcmtk/ofstd/ofstdinc.h中包含的文件中:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/xcodefault.xctoolchain/usr/include/c++/v1/cmath:313:9:错误:全局命名空间中没有名为“signbit”的成员;是吗
你是说“sigwait”吗?
使用::signbit;
~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/signal.h:101:5:注意:此处声明了“sigwait”
int sigwait(常数sigset\u t*\u限制,int*\u限制)\u达尔文\u别名\u C(sigwait);
^
在/Users/adminuser/Documents/playway/SURMaker/MakerApp.cpp中包含的文件中:5:
在/opt/local/include/dcmtk/dcmdata/dctk.h中包含的文件中:28:
在/opt/local/include/dcmtk/dcmdata/dctypes.h:27中包含的文件中:
在/opt/local/include/dcmtk/oflog/oflog.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofstd/ofcanpp.h中包含的文件中:29:
在/opt/local/include/dcmtk/ofstd/ofcmdln.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofsd/offile.h中包含的文件中:30:
在/opt/local/include/dcmtk/ofstd/ofstd.h中包含的文件中:33:
在/opt/local/include/dcmtk/ofsd/oflimits.h:88中包含的文件中:
在/opt/local/include/dcmtk/ofstd/ofstdinc.h中包含的文件中:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:314:9:错误:全局命名空间中没有名为“fpclassify”的成员
使用:fp分类;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:315:9:错误:全局命名空间中没有名为“isfinite”的成员;是吗
“有限”是什么意思?
使用::isfinite;
~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/math.h:749:12:注意:此处声明了“finite”
外部整数有限(双精度)
^
在/Users/adminuser/Documents/playway/SURMaker/MakerApp.cpp中包含的文件中:5:
在/opt/local/include/dcmtk/dcmdata/dctk.h中包含的文件中:28:
在/opt/local/include/dcmtk/dcmdata/dctypes.h:27中包含的文件中:
在/opt/local/include/dcmtk/oflog/oflog.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofstd/ofcanpp.h中包含的文件中:29:
在/opt/local/include/dcmtk/ofstd/ofcmdln.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofsd/offile.h中包含的文件中:30:
在/opt/local/include/dcmtk/ofstd/ofstd.h中包含的文件中:33:
在/opt/local/include/dcmtk/ofsd/oflimits.h:88中包含的文件中:
在/opt/local/include/dcmtk/ofstd/ofstdinc.h中包含的文件中:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/xcodefault.xctoolchain/usr/include/c++/v1/cmath:316:9:错误:全局命名空间中没有名为“isinf”的成员
使用::isinf;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/xcodefault.xctoolchain/usr/include/c++/v1/cmath:317:9:错误:全局命名空间中没有名为“isnan”的成员
使用::isnan;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:318:9:错误:全局命名空间中没有名为“isnormal”的成员
使用::是正常的;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:319:7:错误:全局命名空间中没有名为“ismorer”的成员;是吗
平均值“::标准::更大”?
使用::isgreat;
^~
/Applications/Xcode.app/Contents/Developer/toolschains/xcodefault.xctoolschain/usr/include/c++/v1/functional:720:29:注意:“::std::moreral”在此处声明
结构LIBCPP模板VIS更大:二进制函数
^
在/Users/adminuser/Documents/playway/SURMaker/MakerApp.cpp中包含的文件中:5:
在/opt/local/include/dcmtk/dcmdata/dctk.h中包含的文件中:28:
在/opt/local/include/dcmtk/dcmdata/dctypes.h:27中包含的文件中:
在/opt/local/include/dcmtk/oflog/oflog.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofstd/ofcanpp.h中包含的文件中:29:
在/opt/local/include/dcmtk/ofstd/ofcmdln.h中包含的文件中:32:
在/opt/local/include/dcmtk/ofsd/offile.h中包含的文件中:30:
在/opt/local/include/dcmtk/ofstd/ofstd.h中包含的文件中:33:
在/opt/local/include/dcmtk/ofsd/oflimits.h:88中包含的文件中:
在/opt/local/include/dcmtk/ofstd/ofstdinc.h中包含的文件中:219:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:320:7:错误:全局命名空间中没有名为“isgreaterequal”的成员;
你的意思是“::std::更大
...
find_package(DCMTK REQUIRED)

include_directories(${DCMTK_INCLUDE_DIRS})
add_executable(EXE main.cpp)
target_link_libraries(EXE ${DCMTK_LIBRARIES})
...