Куча предупреждений при компиляции проекта

Это русская секция форума wxWidjets. В этой секции вы можете обсуждать любые вопросы, связанные с wxWidgets на вашем родном языке.
Post Reply
alex7902
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Dec 20, 2015 7:25 am

Куча предупреждений при компиляции проекта

Post by alex7902 » Sun Dec 20, 2015 7:57 am

wxWidgets-3.0.2, CodeBlocks-13.12 и компилятор MinGW-W64-builds-4.2.0 Windows 7_64. Берем любой пример из папки samples из скаченного архива wxWidgets-3.0.2.zip с оф. сайта (например power\power.cpp). В CodeBlocks создаем пустой wxWidgets project (с именем например wxpower) и добавляем наш power.cpp. Далее ничего не трогая просто компилируем проект (флаги компилятора: -s -O2 -pipe -mthreads, #defines __GNUWIN32__ __WXMSW__ wxUSE_UNICODE у линковщика только библиотеки) если все правильно настроено то получаем 22 предупреждения: что:

Code: Select all

||=== Сборка: Release in wxpower (compiler: Mingw32) ===|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryValidator(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3683|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3682|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryParent(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3686|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3685|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryValidator(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3683|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3682|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryParent(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3686|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3685|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetVirtualSizeHints(int, int, int, int)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|459|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::MakeModal(bool)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|688|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|1872|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryValidator(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3683|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3682|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryParent(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3686|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3685|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetVirtualSizeHints(int, int, int, int)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|459|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::MakeModal(bool)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|688|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|1872|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryValidator(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3683|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3682|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryParent(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3686|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3685|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetVirtualSizeHints(int, int, int, int)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|459|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::MakeModal(bool)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|688|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|1872|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryValidator(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3683|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3682|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual bool wxEvtHandler::TryParent(wxEvent&)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3686|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\event.h|3685|note: in expansion of macro 'wxDEPRECATED_BUT_USED_INTERNALLY_INLINE'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetVirtualSizeHints(int, int, int, int)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|459|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::MakeModal(bool)' is deprecated [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|688|note: declared here|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\defs.h|615|note: in definition of macro 'wxDEPRECATED'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\app.h|885|warning: 'virtual void wxWindowBase::SetInitialBestSize(const wxSize&)' is deprecated: use SetInitialSize() instead. [-Wdeprecated-declarations]|
D:\QtProgs\CodeBloks\wxpower\power.cpp|199|note: in expansion of macro 'IMPLEMENT_APP'|
C:\Program Files (x86)\CodeBlocks\wx32\include\wx\window.h|1872|note: declared here|
||=== Build finished: 0 error(s), 22 warning(s) (0 minute(s), 6 second(s)) ===|
вот исходник power.cpp:

Code: Select all

/////////////////////////////////////////////////////////////////////////////
// Name:        power.cpp
// Purpose:     wxWidgets power management sample
// Author:      Vadim Zeitlin
// Created:     2006-05-27
// Copyright:   (C) 2006 Vadim Zeitlin <[email protected]>
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// ============================================================================
// declarations
// ============================================================================

// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------

#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include "wx/app.h"
    #include "wx/frame.h"
    #include "wx/log.h"
#endif

#include "wx/textctrl.h"
#include "wx/msgdlg.h"

#include "wx/power.h"

#ifndef wxHAS_IMAGES_IN_RESOURCES
    #include "sample.xpm"
#endif

// ----------------------------------------------------------------------------
// main frame class
// ----------------------------------------------------------------------------

class MyFrame : public wxFrame
{
public:
    MyFrame()
        : wxFrame(NULL, wxID_ANY, wxT("wxWidgets Power Management Sample"),
                  wxDefaultPosition, wxSize(500, 200))
    {
        wxTextCtrl *text = new wxTextCtrl(this, wxID_ANY, wxT(""),
                                          wxDefaultPosition, wxDefaultSize,
                                          wxTE_MULTILINE | wxTE_READONLY);
        m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(text));

        CreateStatusBar();

        SetIcon(wxICON(sample));

        UpdatePowerSettings(wxPOWER_UNKNOWN, wxBATTERY_UNKNOWN_STATE);

        Show();
    }

    virtual ~MyFrame()
    {
        delete wxLog::SetActiveTarget(m_logOld);
    }

private:
    void OnIdle(wxIdleEvent& WXUNUSED(event))
    {
        const wxPowerType powerType = wxGetPowerType();
        const wxBatteryState batteryState = wxGetBatteryState();
        if ( powerType != m_powerType || batteryState != m_batteryState )
        {
            UpdatePowerSettings(powerType, batteryState);
        }
    }

#ifdef wxHAS_POWER_EVENTS
    void OnSuspending(wxPowerEvent& event)
    {
        wxLogMessage(wxT("System suspend starting..."));
        if ( wxMessageBox(wxT("Veto suspend?"), wxT("Please answer"),
                          wxYES_NO, this) == wxYES )
        {
            event.Veto();
            wxLogMessage(wxT("Vetoed suspend."));
        }
    }

    void OnSuspended(wxPowerEvent& WXUNUSED(event))
    {
        wxLogMessage(wxT("System is going to suspend."));
    }

    void OnSuspendCancel(wxPowerEvent& WXUNUSED(event))
    {
        wxLogMessage(wxT("System suspend was cancelled."));
    }

    void OnResume(wxPowerEvent& WXUNUSED(event))
    {
        wxLogMessage(wxT("System resumed from suspend."));
    }
#endif // wxHAS_POWER_EVENTS


    void UpdatePowerSettings(wxPowerType powerType, wxBatteryState batteryState)
    {
        wxString powerStr;
        switch ( m_powerType = powerType )
        {
            case wxPOWER_SOCKET:
                powerStr = wxT("wall");
                break;

            case wxPOWER_BATTERY:
                powerStr = wxT("battery");
                break;

            default:
                wxFAIL_MSG(wxT("unknown wxPowerType value"));
                // fall through

            case wxPOWER_UNKNOWN:
                powerStr = wxT("psychic");
                break;
        }

        wxString batteryStr;
        switch ( m_batteryState = batteryState )
        {
            case wxBATTERY_NORMAL_STATE:
                batteryStr = wxT("charged");
                break;

            case wxBATTERY_LOW_STATE:
                batteryStr = wxT("low");
                break;

            case wxBATTERY_CRITICAL_STATE:
                batteryStr = wxT("critical");
                break;

            case wxBATTERY_SHUTDOWN_STATE:
                batteryStr = wxT("empty");
                break;

            default:
                wxFAIL_MSG(wxT("unknown wxBatteryState value"));
                // fall through

            case wxBATTERY_UNKNOWN_STATE:
                batteryStr = wxT("unknown");
                break;
        }

        SetStatusText(wxString::Format(
                        wxT("System is on %s power, battery state is %s"),
                        powerStr.c_str(),
                        batteryStr.c_str()));
    }

    wxPowerType m_powerType;
    wxBatteryState m_batteryState;

    wxLog *m_logOld;

    wxDECLARE_EVENT_TABLE();
};

wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_IDLE(MyFrame::OnIdle)

#ifdef wxHAS_POWER_EVENTS
    EVT_POWER_SUSPENDING(MyFrame::OnSuspending)
    EVT_POWER_SUSPENDED(MyFrame::OnSuspended)
    EVT_POWER_SUSPEND_CANCEL(MyFrame::OnSuspendCancel)
    EVT_POWER_RESUME(MyFrame::OnResume)
#endif // wxHAS_POWER_EVENTS
wxEND_EVENT_TABLE()

// ----------------------------------------------------------------------------
// main application class
// ----------------------------------------------------------------------------

class MyApp : public wxApp
{
public:
    virtual bool OnInit()
    {
        new MyFrame;

        return true;
    }
};

IMPLEMENT_APP(MyApp)
И так с любым проектом, сообщения все идентичны. Я так понимаю, что столько предупреждений это не есть хорошо , что так не должно быть (хотя приложение работает нормально). Помогите разобраться.

alex7902
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Dec 20, 2015 7:25 am

Re: Куча предупреждений при компиляции проекта

Post by alex7902 » Tue Dec 22, 2015 4:23 pm

В линуксе, кстати собирается все нормально предупреждений нет:

Code: Select all

-------------- Build: Release in wxtest (compiler: GNU GCC Compiler)---------------

g++ -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread  -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread  -O2     -I/usr/include/wx-2.8 -I/usr/lib64/wx/include/gtk2-unicode-release-2.8  -c /home/alex/CodeBlocks/wxwidgets/wxtest/wxtestMain.cpp -o obj/Release/wxtestMain.o
g++  -o bin/Release/wxtest obj/Release/wxtestApp.o obj/Release/wxtestMain.o   -s -pthread -Wl,-z,relro   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8   -pthread -Wl,-z,relro   -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8  
Output size is 64,32 KB
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings (0 minutes, 1 seconds)
Правда версия wxWidgets 2.8

User avatar
T-Rex
Moderator
Moderator
Posts: 1178
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: Куча предупреждений при компиляции проекта

Post by T-Rex » Thu Jan 07, 2016 12:27 pm

На первый взгляд ругается на deprecated макрос IMPLEMENT_APP(). Попробуй wxIMPLEMENT_APP() - в документации везде он фигурирует.

Post Reply