Release模式编译出现问题--VC++
我正在 VC++ 中以发布模式编译我的项目。 我有一个 .def 文件,我在其中声明了 setLog,现在我 链接时出现以下错误
... 创建库 Release/HKL.lib 和对象 Release/HKL.exp HKL_libinterface.obj :错误 LNK2001:无法解析的外部符号 _SCTP_setLog@8
请帮助我解决上述问题。
谢谢
I am compiling my project in the release mode in VC++.
I have a .def file where i have declared the setLog and now i
am getting following error
Linking...
Creating library Release/HKL.lib and object Release/HKL.exp
HKL_libinterface.obj : error LNK2001: unresolved external symbol _SCTP_setLog@8
Please help me on the above to fix the problem.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我看来,您在调试版本中配置了一个 lib 文件,而该文件不在发布版本中。 您的
setLog()
函数似乎不是链接器所抱怨的函数 - 听起来好像没有找到名为SCTP_setLog()
的函数。查看您在项目的调试配置中配置的库列表,并确保它们也在发布配置中配置。
It sounds to me like you have a lib file configured in your debug build that is not in the release build. Your
setLog()
function does not seem to be the function the linker is complaining about - it sounds like it's not finding a function calledSCTP_setLog()
.Look in the list of libraries you have configured in your project's debug configuration and make sure they are also configured in the release configuration.
如果在调试模式下编译,最可能的原因是,实现此函数的代码未包含在构建中 - 例如,实现它的 cpp 文件设置了“从构建中排除”。
If this compiles in Debug mode the most possible reason is that somehow the code where this function is implemented is not included into build - for example, the cpp file where it is implemented has "Excluded from build" set.
正如 Sharptooth 提到的,您很可能没有在发布版本中编译上述函数。 除了查找“从构建中排除”之外,还要检查您是否设置了(或未设置)任何定义,以从发布构建中排除缺少的函数。
As sharptooth mentioned, you most likely are not compiling the above function in your release build. In addition to looking for 'Excluded from build', check if you have any defines set (or not set) that would exclude the missing function from your release build.