我已经使用 cmake 在 Linux 上使用 gcc 编译器构建了一个静态库,现在正在使用 msvc 编译器移植到 Windows。我将 CLion 与默认生成器一起使用,即 NMakefiles x64。我已经设法让我的库构建没有错误,但是当我尝试运行库中的任何代码时,程序就会崩溃。在尝试调试时,我正在使用dumpbin.exe
查找 COFF 表中缺少的函数名称。
> dumpbin /symbols .\redland-combined.lib | findstr "UNDEF"
给了我一长串UNDEF
符号。这是摘录
...
093 00000000 UNDEF notype External | raptor_xml_namespace_uri
012 00000000 UNDEF notype () External | free
013 00000000 UNDEF notype () External | malloc
014 00000000 UNDEF notype () External | raptor_namespaces_start_namespace
015 00000000 UNDEF notype () External | raptor_new_namespace
018 00000000 UNDEF notype () External | raptor_librdfa_rdfa_iri_get_base
01A 00000000 UNDEF notype () External | raptor_librdfa_rdfa_create_mapping
01B 00000000 UNDEF notype () External | raptor_librdfa_rdfa_copy_mapping
01C 00000000 UNDEF notype () External | raptor_librdfa_rdfa_update_mapping
01D 00000000 UNDEF notype () External | raptor_librdfa_rdfa_free_mapping
01E 00000000 UNDEF notype () External | raptor_librdfa_rdfa_create_list
01F 00000000 UNDEF notype () External | raptor_librdfa_rdfa_replace_list
020 00000000 UNDEF notype () External | raptor_librdfa_rdfa_pop_item
021 00000000 UNDEF notype () External | raptor_librdfa_rdfa_free_list
022 00000000 UNDEF notype () External | raptor_librdfa_rdfa_replace_string
026 00000000 UNDEF notype () External | memset
列出的一些符号是我正在尝试构建的库的一部分,而其他符号来自依赖库。所有这一切都让我感到困惑,因为我已经两次和三次检查了包含路径和链接库是否准确 - 此外,如果这些不准确,我们不应该得到编译/链接器错误吗?我最困惑的是那里malloc
和free
那里的存在。我需要做什么才能将表格中的标签转换为malloc
from EXTERNAL
to STATIC
?