我的环境:
- Qt Creator 2.3.1
- Qt 4.7.4(32 位)
- Windows 7 旗舰版(64 位)
尝试在 Qt for Windows 中重建项目时,我遇到以下编译器警告:
warning: auto-importing has been activated without --enable-auto-import specified on the command line. This should work unless it involves constant data structures referencing symbols from auto-imported DLLs.
发出此警告的项目包含一个 DLL 文件。尽管有警告,DLL 中的类和函数仍可访问。
警告是什么意思?如何解决?
最佳答案
这是一个 MingW 特定的警告,告诉您几个动态库正在隐式链接。那完全没问题。要修复它,您实际上是按照警告告诉您的操作并指定选项:
g++ -o prog file1.o file2.o --enable-auto-import
^^^^^^^^^^^^^^^^^^^^
(顺便说一句,如果您要为 Windows 分发可执行文件,您可能还想链接 -static-libgcc
和 -static-libstdc++
以避免依赖编译器的运行时库。)
关于c++ - 警告 : auto-importing has been activated without --enable-auto-import specified on the command line,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8375310/