I am compiling on windows with cdt/mingw. I like to compile warning free. I get the following warning:
auto-importing has been activated w开发者_如何学Pythonithout --enable-auto-import specified
on the command line.
The following page suggests the way to deal with it is to just adding that option to the command line of ld.
4.8 ld and WIN32 (cygwin/mingw)
The question is thus, how do you change the default command line switches for the built in toolchains?
I would also like to set the warning level of gcc.
You have to send the parameter to the linker via gcc's -Wl
parameter:
-Wl
,optionPass option as an option to the linker. If option contains commas, it is split into multiple options at the commas. You can use this syntax to pass an argument to the option. For example,
-Wl,-Map,output.map
passes-Map output.map
to the linker. When using the GNU linker, you can also get the same effect with-Wl,-Map=output.map
.
So, you need (and me too :)) -Wl,--enable-auto-import
.
For controlling warning levels, see the official docs.
Hi so far I have found a partial solution to this problem. I have not found how I can change the default toolchain options, but I have found how to change them on a project basis.
In project->properties->C++-build->settings
It seems to make more sense if it would be in tool chain editor, but it isn't.
There you have a tab called Tool Settings and looking down there is MinGW C++ Linker->Miscellaneous.
Here on the right you can add extra linker options. Above you also have the compiler and warning settings are implemented as checkboxes which is nice.
So far at least I have gotten started, only a pity I have to do that over for every project individually.
Oh for further confusion, this is not always there, and I have some old projects from before I installed MinGW and who thus have no real toolchain installed. In that case the settings pane only has the Binary Parsers and Error Parsers tabs, so it looks completely different. The secret is in having the Tool Settings Tab. Very dynamic and for the rainforest like settings dialog of eclipse also very confusing.
精彩评论