Author Topic: warning: inline function ... declared as dllimport  (Read 14091 times)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
warning: inline function ... declared as dllimport
« on: May 05, 2005, 04:15:36 pm »
Whenever I compile C::B application using the default Project configuration file "CodeBlocks-wx2.6.0.cbp" from cvs ,
which sets compiler option -Wall,
I get thousands of warnings that look something like this:

Quote
..wx260/include/wx/buffer.h:96: warning: inline function 'wxCharBuffer::wxCharBuffer(const char*)' is declared as dllimport: attribute ignored.


You can't have it both dllimport and inline.

This is fine, but I don't want this warning. I want the inlined version.

Is there a way to disable this warning? I didn't see anything that looked
useful in the GCC manual.

using
MinGW gcc 3.4.2, wxMSW 2.6.2, WinXP


[edit]
@all,
additionally i would like to know, if others get the same tons of warnings.
is this normal behaviour ?
otherwise i have to look if something is wrongly set up in my wxwidgets configuration.

thanks, tiwag

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
warning: inline function ... declared as dllimport
« Reply #1 on: May 05, 2005, 10:31:29 pm »
wxWidgets-2.6.0 generate a gazillion of warnings for me too...
I know I 'm not of much help, but I just thought I 'd share  :roll:

Yiannis.
Be patient!
This bug will be fixed soon...

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
warnings using GCC and wx_dll
« Reply #2 on: May 22, 2005, 07:33:43 pm »
i found a way to avoid the

    warning: inline function 'wxcfoo::wxfoo()' is declared as dllimport: attribute ignored.[/list:u]

    when compiling wxWidgets applications using the gcc_dll libraries,
    and simultaneously using the compiler warnings i.e. "not to disable warnings in general"

    one needs to use the following compiler setting:

    Code::Blocks compiler settings:
    check the following warnings
    ------------------------------------------------------------------------------
    * Enable all compiler warnings (overrride every other setting)  ..... results to (-Wall)
    * Enable warnings demanded by strict ISO C ans ISO C++  ..... results to (-pedantic)

    use the following under
    more options:
    ------------------------------------------------------------------------------
    -Wno-long-long
    -Wcast-align
    -Wconversion
    -Wdeprecated
    -Wimport
    -Wnon-template-friend
    -Wpmf-conversions
    -Wpointer-arith
    -Wsign-compare
    -Wsynth
    -Wwrite-strings[/list:u]

    THis allows to compile standard wxWidgets samples like
    minimal, console, listbox and widgets
    ( at least they i've tested ) without compile warnings.


    When i try to build codeblocks with this compiler settings,
    i found a few warnings and also compile errors,
    which are trivial to avoid following the suggested actions from the warning- or error-messages.
    When i do this corrections to the CB code i'm not longer in sync with the CVS version to incorporate latest diffs easy.

    therefore i would like to know, if mandrav maybe is interested in using more effective compiler warning settings, in order to avoid hundreds of these nasty dll-import warnings with the effect, that some important and useful warnings are likely to be overseen in the vast number of warnings.

    As i mentioned it would need some corrections to the code base,
    things like
      removing additional semicolons after some wxWidgets MACROS,
      some class declarations are unnecessary here and there,[/list:u]

      which i can do, if mandrav is interested in.


      if one wants to experiment with it, here is the standard minimal sample,
      which doesn't produce any warnings with my proposed compiler warning settings, when compiled to the gcc_dll wxwidget 2.4.2  and  2.6.0  libs.


    Code

    /* wxminimal.cpp */

    #include "wx/wx.h"

    class HelloWorldApp : public wxApp
    {
    public:
        virtual bool OnInit();
    };

    IMPLEMENT_APP(HelloWorldApp)

    bool HelloWorldApp::OnInit()
    {
        wxFrame * frame = new wxFrame((wxFrame *) NULL, -1,
                                      _T("Hello ")
                                      _T(wxVERSION_STRING),
                                      wxPoint(60,70),
                                      wxSize(300,160));

        frame->Show(TRUE);

        SetTopWindow(frame);

        return true;
    }


    regards,
    tiwag

    Offline mandrav

    • Project Leader
    • Administrator
    • Lives here!
    • *****
    • Posts: 4315
      • Code::Blocks IDE
    warning: inline function ... declared as dllimport
    « Reply #3 on: May 22, 2005, 08:54:00 pm »
    Quote
    which i can do, if mandrav is interested in.

    Sure, just submit a patch :)

    Yiannis.
    Be patient!
    This bug will be fixed soon...

    Offline heromyth

    • Multiple posting newcomer
    • *
    • Posts: 98
      • http://
    warning: inline function ... declared as dllimport
    « Reply #4 on: July 01, 2005, 04:45:11 am »
    Yeah, I have found that it won't produce the warning without the GCC compiler option '-W'. I have replace all '-W' in wxWidgets' makefile with none.