Warning: automatic import was activated without --enable-auto-import specified on the command line

My environment:

  • Qt Creator 2.3.1
  • Qt 4.7.4 (32 bit)
  • Windows 7 Ultimate (64 bit)

When I try to rebuild the project in Qt for Windows, I get the following warning about the compiler:

warning: automatic import was activated without the --enable-auto-import specified on the command line. This should work if it is not associated with persistent data structures that reference characters from automatically imported DLLs.

A project that emits this warning includes a DLL file. Despite the warning, classes and functions in the DLL are available.

What does a warning mean? How to fix it?

+4
source share
2 answers

This is a special warning from MingW that states that several dynamic libraries are implicitly linked. It's fine. To fix this, you literally do what warns about it, and specify a parameter:

g++ -o prog file1.o file2.o --enable-auto-import ^^^^^^^^^^^^^^^^^^^^ 

(By the way, if you are distributing executables for Windows, you may need a link to -static-libgcc and -static-libstdc++ to avoid dependency on compiler runtime libraries.)

+3
source

If you are using Code :: block environment, you should do this:

The following steps will add the option "-Wl, - enable-auto-import" for a specific CodeBlocks project:

  1. Open your project in CodeBlocks.
  2. Open the Project menu → Build Options
  3. Go to the "Linker Settings" tab
  4. In the "Other link options" text box, enter "-Wl, - enable-auto-import"

To add this default option to an ALL project, follow these steps:

  1. go to the menu "Settings" → "Compiler and debugger ..."
  2. choose your compiler (GNU GCC Compiler)
  3. Go to the "Linker Settings" tab
  4. In the "Other link options" text box, enter "-Wl, - enable-auto-import"
0
source

Source: https://habr.com/ru/post/1384571/


All Articles