问题描述
我正在我的库中链接 SOIL,但是当我编译时,我收到这些链接器错误:
<前>1>LINK : 警告 LNK4098: defaultlib 'MSVCRT' 与其他库的使用冲突;使用/NODEFAULTLIB:library1>libSOIL.lib(stb_image_aug.o):错误 LNK2019:未解析的外部符号 __alloca 在函数 _stbi_zlib_decode_noheader_buffer 中引用1>libSOIL.lib(image_helper.o):错误LNK2019:函数_RGBE_to_RGBdivA2中引用的未解析的外部符号_sqrtf我确实在附加依赖项中链接了 libSOIL.lib.
未解决的符号错误,错误 LNK2019,来自 libgcc.lib 或其他标准库实现中的符号(参见 此处 用于 Microsoft 选项)未链接到.alloca 和 sqrtf 都是标准库函数.
如果您没有链接到标准库,则通过将其添加到您的链接器库路径来链接到一个标准库.
从上面警告 LNK4098 的警告来看,您更有可能链接到标准库,但链接器不知道要加载哪个库.
推荐链接器参数来消除这个问题(告诉链接器选择一个特定的标准库)是/NODEFAULTLIB:"MSVCRT"/NODEFAULTLIB:"LIBCMT.
有关其他信息和资源,请参阅以下链接
- 链接器工具警告 LNK4098
- 链接问题解决
- Visual C++ 中的默认库
- 解决 LNK4098:defaultlib 'MSVCRT' 与堆栈溢出问题冲突
I am linking SOIL in my library but when I compile I get these linker errors:
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library 1>libSOIL.lib(stb_image_aug.o) : error LNK2019: unresolved external symbol __alloca referenced in function _stbi_zlib_decode_noheader_buffer 1>libSOIL.lib(image_helper.o) : error LNK2019: unresolved external symbol _sqrtf referenced in function _RGBE_to_RGBdivA2
I did link libSOIL.lib in the addition dependencies.
The unresolved symbol errors, error LNK2019, are from the symbols in libgcc.lib or another standard library implementation (see here for the Microsoft Options) not being linked to. alloca and sqrtf are both standard library functions.
If you aren't linking to a standard library, then link to one by adding it to your linker library path.
From the warning above warning LNK4098, it is more likely you are linking to a standard library but the linker doesn't know which on to load.
Recommend LINKER arguments to make this problem go away (tell the linker to choose a specific standard library) are /NODEFAULTLIB:"MSVCRT" /NODEFAULTLIB:"LIBCMT.
See the following links for additional information and resources
- Linker Tools Warning LNK4098
- Linking problems SOLVED
- Default Libraries in Visual C++
- Resolving LNK4098: defaultlib 'MSVCRT' conflicts with Stack Overflow Question
这篇关于SOIL 连接不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!