Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / First time user of WxWindows with DevC++

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. First time user of WxWindows with DevC++
#2470
Posted by: 2003-08-16 19:00:09
Hello,
 
I have this question some time back, but never got a solution to the problem. I am trying to use WxWindows with DevC++. To do this, I downloaded DevC++ Beta 8 and the DevPak for WxWindows 2.4 (Approx 6.4 Mb). I created a new project and the template creates 2 files called base.h and base.cpp (I have attached these files)
 
When I compile these files the first time, I get many compiler errors. The first one points to a line that says
#include "backward_warning.h"
The error says
31 C:Dev-Cppincludec++backwardiostream.h
In file included from C:/Dev-Cpp/include/c++/backward/iostream.h
 
If I say complie again, thenm it begins to link the file and then gives 2 errors
Dev-CppBin..libgcc-libmingw323.2........mingw32binld.exe C:Dev-CppC
cannot find -lwxmsw
 C:Dev-CppMakefile.win
[Build Error]  [temp.exe] Error 1
 
If I go again to Execute> Syntax I get all the compiler errors again.
I have no idea what is hapenning here.
 
I used to have the same problem with the WxWindows 2.29 DevPak. I finally gave up. I would really like to get started on my dream application, but at the same time, I don't have the $$$ to buy VC++. BTW, Dev C++ works perfectly in VC++ in my office.
 
Please can someone help.
 
Thank you,
 
- Sid
Message2. Re: First time user of WxWindows with DevC++
#2471
Posted by: 2003-08-16 19:05:19
The source file does not seem to be attached so here is the source code

base.h
#ifndef __BASE_H
#define __BASE_H

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

class MainFrame: public wxFrame
{
  public:
      MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size);
      void OnQuit(wxCommandEvent &event);
  private:
      DECLARE_EVENT_TABLE()
};

enum
{
   MainWin_Quit = wxID_HIGHEST+1
};

BEGIN_EVENT_TABLE(MainFrame, wxFrame)
   EVT_MENU(MainWin_Quit, MainFrame::OnQuit)
END_EVENT_TABLE()

#endif
base.cpp
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
   #include <wx/wx.h>
#endif

#include "base.h"

IMPLEMENT_APP(MainApp)

bool MainApp::OnInit()
{
   MainFrame *win = new MainFrame("Frame", wxPoint (100, 100),
     wxSize(450, 340));
   win->Show(TRUE);
   SetTopWindow(win);

   return TRUE;
}

MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
    : wxFrame((wxFrame *) NULL, -1, title, pos, size)
{
    wxMenu *FileMenu = new wxMenu;
    wxMenuBar *MenuBar = new wxMenuBar;

    FileMenu->Append(MainWin_Quit, "&Quit");

    MenuBar->Append(FileMenu, "&File");
    SetMenuBar(MenuBar);

    CreateStatusBar(2);
    SetStatusText("Hello World!");
}

void MainFrame::OnQuit(wxCommandEvent & WXUNUSED(event))
{
    Close(TRUE);
}
Message3. Re: First time user of WxWindows with DevC++
#2472
Posted by: guidance 2003-08-16 23:07:53
Seems your wxwindows library is not named as libwxmsw.a that your linker can't find, may try this one (software/wxwidgets/Compiler Options for Dev-C++.txt):
http://g.yi.org/f.php?f=6592#14289
Message4. Re: First time user of WxWindows with DevC++
#2474
Posted by: 2003-08-17 05:53:24
WOW! It started working. Thanks a milion guidance. You saved me!!!! Now I can be free of M$ and code away.

Who are you. Are you part of the DevC++ team???

In any case THANK YOU VERY MUCH
Message5. Re: First time user of WxWindows with DevC++
#2475
Posted by: guidance 2003-08-17 08:28:42
Glad to help you!
I'm just an user of wxWindows and hate to use M$. After I met dev-cpp, I decided to setup this alternative forum.

One disadvantage of mingw (gcc) is the exe file size, I heard it's due to the gcc linker is not perfect enough to remove unused lib functions, that's really bad for wxWindows apps.
Message6. Re: First time user of WxWindows with DevC++
#2476
Posted by: 2003-08-17 15:43:13
but it seems like the exe file that compiled so large...
Message7. Re: First time user of WxWindows with DevC++
#3400
Posted by: 2004-02-22 04:15:24
Seems your wxwindows library is not named as libwxmsw.a that your linker can't find, may try this one:


.. Seems like someone removed whatever followed "this one:" ...  which is exacly what I need to solve this same issue :).
Message8. Re: First time user of WxWindows with DevC++
#3402
Posted by: 2004-02-22 16:06:51
Did you tried the program 'strip' distributed with MinGW and Dev-cpp? It strips the .exe file to make it much smaller.
Message9. Re: First time user of WxWindows with DevC++
#3404
Posted by: upCASE 2004-02-25 02:21:47
Hi!
Problem with newer version of gcc is the overhead caused by the C++ runtime.
To reduce the apps size use either "strip" at the command line, or let tha linker do it during compilation by add the -s option to your linker settings (I suggest the last one, because it seems that this is more efficient).
Use one of the -O options to optimize (-O2 is normally fine, -Os doesn't seem to be that good).
Have a look at the -f options (maybe exclude exceptions since wxWindows doesn't currently use them).
Use UPX for your release.
BTW: I guess you're using my devpak. I'm pretty sure that the needed defines where missing for compilation and that's why you got a backward compatiblity warning.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2022-10-7  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0