Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

wxWindows - greska

[es] :: C/C++ programiranje :: wxWindows - greska

[ Pregleda: 2785 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

NeznamTkoSam

Član broj: 39660
Poruke: 279
*.cmu.carnet.hr.



Profil

icon wxWindows - greska08.02.2005. u 19:43 - pre 235 meseci
Ovo je kod:
Code:
/////////////////////////////////////////////////////////////////////////////
// Name:        minimal.cpp
// Purpose:     Minimal wxWindows sample
// Author:      Julian Smart
// Modified by:
// Created:     04/01/98
// RCS-ID:      $Id: minimal.cpp,v 1.57 2002/04/07 21:12:45 JS Exp $
// Copyright:   (c) Julian Smart
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

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

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

// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
    #pragma hdrstop
#endif

// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers)
#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------

// the application icon (under Windows and OS/2 it is in resources)
#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
    #include "mondrian.xpm"
#endif

// ----------------------------------------------------------------------------
// private classes
// ----------------------------------------------------------------------------

// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
    // override base class virtuals
    // ----------------------------

    // this one is called on application startup and is a good place for the app
    // initialization (doing it here and not in the ctor allows to have an error
    // return: if OnInit() returns false, the application terminates)
    virtual bool OnInit();
};

// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
    // ctor(s)
    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
            long style = wxDEFAULT_FRAME_STYLE);

    // event handlers (these functions should _not_ be virtual)
    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

private:
    // any class wishing to process wxWindows events must use this macro
    DECLARE_EVENT_TABLE()
};

// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------

// IDs for the controls and the menu commands
enum
{
    // menu items
    Minimal_Quit = 1,

    // it is important for the id corresponding to the "About" command to have
    // this standard value as otherwise it won't be handled properly under Mac
    // (where it is special and put into the "Apple" menu)
    Minimal_About = wxID_ABOUT
};

// ----------------------------------------------------------------------------
// event tables and other macros for wxWindows
// ----------------------------------------------------------------------------

// the event tables connect the wxWindows events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(Minimal_Quit,  MyFrame::OnQuit)
    EVT_MENU(Minimal_About, MyFrame::OnAbout)
END_EVENT_TABLE()

// Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP(MyApp)

// ============================================================================
// implementation
// ============================================================================

// ----------------------------------------------------------------------------
// the application class
// ----------------------------------------------------------------------------

// 'Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
    // create the main application window
    MyFrame *frame = new MyFrame(_T("Minimal wxWindows App"),
                                 wxPoint(50, 50), wxSize(450, 340));

    // and show it (the frames, unlike simple controls, are not shown when
    // created initially)
    frame->Show(TRUE);

    // success: wxApp::OnRun() will be called which will enter the main message
    // loop and the application will run. If we returned FALSE here, the
    // application would exit immediately.
    return TRUE;
}

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

// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
       : wxFrame(NULL, -1, title, pos, size, style)
{
    // set the frame icon
    SetIcon(wxICON(mondrian));

#if wxUSE_MENUS
    // create a menu bar
    wxMenu *menuFile = new wxMenu;

    // the "About" item should be in the help menu
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog"));

    menuFile->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(menuFile, _T("&File"));
    menuBar->Append(helpMenu, _T("&Help"));

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);
#endif // wxUSE_MENUS

#if wxUSE_STATUSBAR
    // create a status bar just for fun (by default with 1 pane only)
    CreateStatusBar(2);
    SetStatusText(_T("Welcome to wxWindows!"));
#endif // wxUSE_STATUSBAR
}


// event handlers

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    // TRUE is to force the frame to close
    Close(TRUE);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxString msg;
    msg.Printf( _T("This is the About dialog of the minimal sample.\n")
                _T("Welcome to %s"), wxVERSION_STRING);

    wxMessageBox(msg, _T("About Minimal"), wxOK | wxICON_INFORMATION, this);
}



Ovo je Compile Log:

Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Glavina\Desktop\Nova mapa\Makefile.win"
Executing make...
make.exe -f "C:\Documents and Settings\Glavina\Desktop\Nova mapa\Makefile.win" all
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" -D_X86_=1 -DWIN32 -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -D__WIN32__ -mthreads -DSTRICT -D__WXMSW__ -D__WINDOWS__ -Wall -fno-pcc-struct-return -O2 -fno-rtti -fno-exceptions

windres.exe -i Project1_private.rc -I rc -o Project1_private.res -O coff

g++.exe main.o Project1_private.res -o "Project1.exe" -L"C:/Dev-Cpp/lib" -mwindows -lwxmswu -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid

C:/Dev-Cpp/lib/libwxmswu.a(mdi.o)(.data$_ZTV14wxMenuItemList+0x0):mdi.cpp: multiple definition of `vtable for wxMenuItemList'
main.o(.rdata$_ZTV14wxMenuItemList+0x0):main.cpp: first defined here

make.exe: *** [Project1.exe] Error 1

Execution terminated

Sto ne valja?
 
Odgovor na temu

idb
Ivan Bulic
Beograd

Član broj: 4436
Poruke: 402



Profil

icon Re: wxWindows - greska09.02.2005. u 07:56 - pre 235 meseci
GCC se ne snalazi bas najbolje sa folderima koji imaju "space" u sebi. Kod tebe je projekt u C:\Documents and Settings\Glavina\Desktop\Nova mapa\.
Probaj da napravis projekt u nekom folderu na primer C:\my_test. Probao sam tvoj primer i kod mene radi (Dev-Cpp 4.9.9.1, wxWidgets 2.4.2).
Ako i dalje ne radi javi sa kojom verzijom Dev-Cpp i wxWidgetsa radis, mozda nisu usaglasene.
 
Odgovor na temu

idb
Ivan Bulic
Beograd

Član broj: 4436
Poruke: 402



Profil

icon Re: wxWindows - greska09.02.2005. u 08:02 - pre 235 meseci
Sad videh jos nesto. Da li si ti rucno dodao sledecu opciju linkerai -lwxmswu ili je ona iz gotovog template-a? Ono u na kraju je za unicode verziju biblioteke (mozda je ti nemas).
 
Odgovor na temu

NeznamTkoSam

Član broj: 39660
Poruke: 279
*.cmu.carnet.hr.



Profil

icon Re: wxWindows - greska09.02.2005. u 20:56 - pre 235 meseci
Idb, ovo sa razmacima svejedno ne radi.
Verzija Dev-C++ je 4.9.9.0, a wxWidgets 2.4.0.

Parametri linkeru su:
-lwxmswu -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid.
 
Odgovor na temu

idb
Ivan Bulic
Beograd

Član broj: 4436
Poruke: 402



Profil

icon Re: wxWindows - greska10.02.2005. u 09:28 - pre 235 meseci
Probao sam da kompajliram sa tvojim opcijama i kopajlera i linkera. Kod mene radi OK.
Citat:
Verzija Dev-C++ je 4.9.9.0, a wxWidgets 2.4.0.

Predpostavljam da tvoja verzija wxWidgetsa potice sa Michel Weinachter's (tiny) Homepage http://michel.weinachter.free.fr/
Mislim da je ta verzija wxWidgets 2.4.0 kompajliran sa starijom verzijom kompajlera (mislim Mingw/GCC 3.2)

Moguca resenja problema:

1. Deinstaliraj wxWidgets 2.4.0, pa instaliraj verziju 2.4.2
- Osnovni paket http://michel.weinachter.free.fr/WxWindows-2.4.2.DevPak
- Dopunski prilozi http://michel.weinachter.free.fr/WxWindows-2.4.2-contribs.DevPak
- ako nisi instalirao (on se mora instalirati pre wxWidgetsa) treba ti i http://michel.weinachter.free.fr/imagelib-2.DevPak

2. Mozes preci i na razvojnu verziju wxWidgets 2.5.3, ali ja licno vise volim stabilne verzije.

3. Ako se odlucis za xWidgets 2.5.3, za njega postoji modifikovani Dev-Cpp. To je wx-Devcpp( http://wxdsgn.sourceforge.net/ ), koji ima dialog editor, i on se moze skinuti kompletno sa wxWidgets 2.5.3. ( http://wxdsgn.sourceforge.net/wxdevcpp-full-setup.exe )

P.S.
1. U linker opcijama dodaj na kraju -s, smanjice ti velicinu EXE fajla.
2. Korisna adreza za razne dodatne pakete: http://www.devpaks.org/
3. Forumi:
- Bloodshed Software Forum: http://sourceforge.net/forum/forum.php?forum_id=48211
- wxWidgets Discussion Forum: http://www.solidsteel.nl/users...d56f15afacb547537f72ea127055ad

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Window 2000, Dev-Cpp 4.9.9.1, wxWidgets 2.4.2
 
Odgovor na temu

NeznamTkoSam

Član broj: 39660
Poruke: 279
*.cmu.carnet.hr.



Profil

icon Re: wxWindows - greska10.02.2005. u 21:38 - pre 235 meseci
Hvala, radi.
Dodavanje -s mi je smanjilo velicinu exe-a za skoro 1 megabajt! Koja je fora u tome?
P.S.
1. Zasto se wxWidgets programi tako dugo kompajliraju?
2. Moze li se u wxWidgets crtati kao sa FLTK ili GDI?
 
Odgovor na temu

idb
Ivan Bulic
Beograd

Član broj: 4436
Poruke: 402



Profil

icon Re: wxWindows - greska11.02.2005. u 11:32 - pre 235 meseci
Citat:
Koja je fora u tome?
mozes potraziti na netu sve opcije GCC (mislim da je bilo i na ovom forumu, ali evo vidi recimo ovde http://www.redhat.com/docs/man...3-Manual/gcc/link-options.html)
Citat:
1. Zasto se wxWidgets programi tako dugo kompajliraju?
Ovo ne zavisi samo od wxWidgetsa (mada dobrim delom DA), nego i od MingGW/GCC
Citat:
2. Moze li se u wxWidgets crtati kao sa FLTK ili GDI?
Moze, mozda cak i bolje. Imas grupu klasa "Device contexts": wxClientDC, wxPaintDC, wxWindowDC, wxScreenDC, wxDC, wxMemoryDC, wxMetafileDC, wxPostScriptDC, wxPrinterDC.
 
Odgovor na temu

[es] :: C/C++ programiranje :: wxWindows - greska

[ Pregleda: 2785 | Odgovora: 6 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.