c++ - 警告 : auto-importing has been activated without --enable-auto-import specified on the command line

标签 c++ qt dll

我的环境:

  • 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/

相关文章:

Java final 成员数据的 C++ 等价物

c++ - QPainter 或 QLabel 绘制 QPixmap 的成本较低

qt - QSocketNotifier : socket notifiers cannot be disabled from another thread

c++ - 向 QGraphicsScene 添加项目时的两个错误

python - DLL 加载失败,而 `import dolphindb`

c++ - 在C++中使用.lib编译然后使用.dll链接或显式调用dll?

c++ - 正则表达式在 #include 双引号内用反斜杠替换斜杠

c++ - 在 For 循环中使用 {} 且不使用 {} 的 If 语句

c++ - 什么更有效率?使用 pow 平方还是仅将其与自身相乘?

c++ - 如何使用自定义注册系统注册 dll 并查看导入的 dll 的可执行文件的 PE?