未解析的外部符号 __imp__Inf 和 __imp__Nan

发布于 2024-12-22 08:58:21 字数 1043 浏览 1 评论 0原文

我只是尝试使用VS2008为WinCE7.0构建Qt,经过大量代码修改后我成功编译了主库。

在编译 QtScript 库时,我收到以下链接器错误:

1>Linking...
1>   Creating library ..\..\lib\QtScript4.lib and object ..\..\lib\QtScript4.exp
1>BytecodeGenerator.obj : error LNK2019: unresolved external symbol __imp__Inf referenced in function "public: static double __cdecl QTWTF::FloatHashTraits<double>::emptyValue(void)" (?emptyValue@?$FloatHashTraits@N@QTWTF@@SANXZ)
1>Executable.obj : error LNK2001: unresolved external symbol __imp__Inf
1>MathObject.obj : error LNK2001: unresolved external symbol __imp__Inf
1>DateMath.obj : error LNK2019: unresolved external symbol __imp__Nan referenced in function "double __cdecl QTWTF::parseDateFromNullTerminatedCharacters(char const *,bool &,int &)" (?parseDateFromNullTerminatedCharacters@QTWTF@@YANPBDAA_NAAH@Z)
1>JSValue.obj : error LNK2001: unresolved external symbol __imp__Nan
1>..\..\lib\QtScript4.dll : fatal error LNK1120: 2 unresolved externals

我完全不知道我错过了链接哪些库!

谢谢

I just tried to build Qt for WinCE7.0 using VS2008 after lots of code modification I successfully compiled main libraries.

While Compiling the QtScript library I received the following linker errors:

1>Linking...
1>   Creating library ..\..\lib\QtScript4.lib and object ..\..\lib\QtScript4.exp
1>BytecodeGenerator.obj : error LNK2019: unresolved external symbol __imp__Inf referenced in function "public: static double __cdecl QTWTF::FloatHashTraits<double>::emptyValue(void)" (?emptyValue@?$FloatHashTraits@N@QTWTF@@SANXZ)
1>Executable.obj : error LNK2001: unresolved external symbol __imp__Inf
1>MathObject.obj : error LNK2001: unresolved external symbol __imp__Inf
1>DateMath.obj : error LNK2019: unresolved external symbol __imp__Nan referenced in function "double __cdecl QTWTF::parseDateFromNullTerminatedCharacters(char const *,bool &,int &)" (?parseDateFromNullTerminatedCharacters@QTWTF@@YANPBDAA_NAAH@Z)
1>JSValue.obj : error LNK2001: unresolved external symbol __imp__Nan
1>..\..\lib\QtScript4.dll : fatal error LNK1120: 2 unresolved externals

I have absolutely no idea which libraries I missed to link with!

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷…雨湿花 2024-12-29 08:58:21

如果您使用的是 Windows,我假设您正在 MSVS 中构建。我经常在没有默认库的情况下启动项目,如果我碰巧从另一个库触及“无法触及”的领域,我会在进行过程中添加我需要的内容。

幸运的是,MSVS 在这方面非常擅长帮助我。只需打开 VERBOSE 编译状态并查看它试图访问哪些库,然后添加它们:
右键单击项目,链接器,显示进度->选择 VERBOSE

另一种方法是当我检查 MSDN 中的 Microsoft 函数并查看它们声明的库并添加它时(因为 VERBOSE 在我糟糕的输出窗口上可能有点过分)。我不知道 Qt 是否有详细的参考文档(也说明了库),但值得一试。

当所有其他方法都失败时,只需添加 Qt 可能需要的所有库(确保 IGNORE STANDARD LIBS 已禁用),然后检查 VERBOSE 并仅将其保留在列表中。

假设您拥有项目中的所有库,另一个问题是依赖项不匹配(右键单击解决方案,启动项目 -> 选择您需要的库,[项目依赖项 -> 映射指定库的每个依赖项)。

还要确保当您导入外部库时,该库已在“链接器”->“输入”中定义。

但是,如果您修改了源代码(添加新函数/全局或静态变量,或者修改了函数签名),则未解析的外部引用意味着函数/var 定义没有关联的主体。要么实现一个,要么在定义中添加 { };因此,如果是这种情况,请检查错误消息中的函数/变量。

If you're using Windows, I'll assume you're building in MSVS. I often start projects WITHOUT default libs and if I happen to touch "out of reach" terriotry from another lib, I add what I need as I go along.

Fortunately, MSVS is great at helping me with this. Just turn VERBOSE compiling status and see what libs it's trying to access, then just add them:
right click the project, linker, show progress -> select VERBOSE

Another method is when I check MSDN for Microsoft functions and see the lib they are declared in and add it (since VERBOSE can be overkill on my poor output window). I don't know if Qt has a detailed reference documentation (also stating the libs) but it's worth a shot.

When all else fails, just add all libs Qt could possibly want (make sure IGNORE STANDARD LIBS is disabled) then check VERBOSE and only keep those in the list.

Assuming you have all the libraries in the project, another problem is mismatched dependencies (right click the solution, startup project -> select the one you need, [project dependencies -> map each dependency for the specified libs).

Also make sure when you import an extern the lib is defined in Linker->Input.

However, if you modified the source (either adding new functions/global or static vars or you modified function signatures), the unresolved external reference means a function/var definition has no associated body. Either implement one or add { } in the definition; so if that's the case, check the functions/vars from the error message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文