Author Topic: Help setting up wxWidgets  (Read 10534 times)

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« on: April 23, 2005, 03:34:23 pm »
Hello everyone.

I'm trying to learn how to use wxWidgets using www.3dbuzz.com C++ Video training. They show you how to install wxwidgets, and what you need to do before using it. The thing is, they use Visual Studio, not Code::Blocks, and I can't exactly follow along the setup.

At some point in time, they go to "Project Properties->C/C++->Preprocesor" and then add:
wxUSE_GUI=1; _WXDEBUG_; WXDEBUG=1

And I can't find "preprocesor" anywhere on codeblocks :)

I tried going along, but... let me show you my code.

Code: [Select]

#include "wx/wx.h"

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

IMPLEMENT_APP(HelloWorldApp)

bool HelloWorldApp::OnInit()
{
    wxFrame *frame = new wxFrame((wxFrame *) NULL, -1, _T("Hello World!"), wxPoint(60,70), wxSize(500,600));
   
    frame->Show(TRUE);

    SetTopWindow(frame);
   
    return true;
}


if I try to compile it, it gives me this error:
'wxAppConsole is an inaccessible base of HelloWorldApp', and it says it's on the
IMPLEMENT_APP(HelloWorldApp) line, so I imagine it has something to do with the preprocesor. I don't know, though.

Can someone help me?

Thanks!!

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Help setting up wxWidgets
« Reply #1 on: April 23, 2005, 04:31:02 pm »
Quote
At some point in time, they go to "Project Properties->C/C++->Preprocesor" and then add:
wxUSE_GUI=1; _WXDEBUG_; WXDEBUG=1

And I can't find "preprocesor" anywhere on codeblocks

It's "Project->Build options->Compiler options->Compiler definitions" :)
Oh, and enter them one-per line like this:
Code: [Select]
wxUSE_GUI=1
_WXDEBUG_
WXDEBUG=1


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

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« Reply #2 on: April 23, 2005, 04:46:52 pm »
Thanks!

But still, I got the error... :D any ideas?

At some point, they use "wxmswd.lib", and I didn't find that in my computer. I added "wxmsw242.dll" that was in the codeblocks dir :D

Any ideas?
I have wxwidgets 2.6, and MinGW.

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« Reply #3 on: April 23, 2005, 05:57:39 pm »
dumb me, i'm missing a ;

Anyway, it still doesn't work. It now tells me "variable 'vtable for wxFrame' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details."
But that just means I have to read a little...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Help setting up wxWidgets
« Reply #4 on: April 23, 2005, 06:03:58 pm »
Quote
At some point, they use "wxmswd.lib", and I didn't find that in my computer. I added "wxmsw242.dll" that was in the codeblocks dir

Put libwxmsw24.a (or libwxmsw242.a?) in linker options, not wxmsw242.dll

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

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« Reply #5 on: April 23, 2005, 06:39:47 pm »
nope, not found that file.
Searched for lib*.a

I have:
libwx_base-2.6.dll.a
libwx_base_net-2.6.dll.a
libwx_base_xml-2.6.dll.a
libwx_msw_adv-2.6.dll.a
libwx_msw_core-2.6.dll.a
libwx_msw_html-2.6.dll.a
libwx_msw_media-2.6.dll.a
libwx_msw_qa-2.6.dll.a
libwx_msw_xrc-2.6.dll.a
libwxexpat-2.6.a
libwxjpeg-2.6.a
libwxpng-2.6.a
libwxregex-2.6.a
libwxtiff-2.6.a
libwxzlib-2.6.a

I've tried with base, core and adv. (since those are the ones that sound more... tryable)

Maybe in 2.6 there is something different, maybe I just did something wrong when compiling wxwidgets?

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« Reply #6 on: April 23, 2005, 11:51:48 pm »
Damn it, one full day lost trying to get a simple program to run...

There is a file called ld.exe inside of my mingw/bin folder. I ran "ld --help" and there IS an option to --enable-auto-import, but I don't know how to tell codeblocks to tell it to use it.

Anonymous

  • Guest
Help setting up wxWidgets
« Reply #7 on: April 23, 2005, 11:53:02 pm »
Try with libwx_msw_core-2.6.dll.a - that seems to be the one.

Offline Xorlium

  • Multiple posting newcomer
  • *
  • Posts: 21
    • http://
Help setting up wxWidgets
« Reply #8 on: April 23, 2005, 11:58:23 pm »
Unless I call both libwx_msw_core-2.6.dll.a and libwx_base-2.6.dll.a it gives me tons of compile errors of "undefined reference to..."

And if I call them both, then I get only 1 error. The vtable one.

Thanks!

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Help setting up wxWidgets
« Reply #9 on: April 24, 2005, 07:26:58 am »
hmmm try disabling the auto-import switch in GCC. add --disable-auto-import to your compiler (or linker?) switches. Then probably you'll get an undefined reference. But maybe it's some configuration error...

did you try to move libwx_base BEFORE libwx_msw_core, in your linker libraries?

Anonymous

  • Guest
Help setting up wxWidgets
« Reply #10 on: April 24, 2005, 08:21:58 pm »
Quote
hmmm try disabling the auto-import switch in GCC. add --disable-auto-import to your compiler (or linker?) switches. Then probably you'll get an undefined reference. But maybe it's some configuration error...

Okay, that could work... I'll try it when I get home.

Quote
did you try to move libwx_base BEFORE libwx_msw_core, in your linker libraries?

Nope... I'll try it too.

Thanks!!

Anonymous

  • Guest
Help setting up wxWidgets
« Reply #11 on: April 24, 2005, 08:41:35 pm »
Look, if you're so frustrated, you can download the 2.4.2 version of wxwidgets (works for me - and I tried to compile Codeblocks with 2.6, but got an autoimport error in stc). So the problem must be obviously a setup problem.

And don't worry about "one full day for a simple program", don't think like that. It's the wxwidgets installation, when you get that part done, you'll be writing hundreds of programs :) Don't give up!

Offline frog-o

  • Multiple posting newcomer
  • *
  • Posts: 61
Help setting up wxWidgets
« Reply #12 on: May 20, 2005, 02:32:59 pm »
It look to me like a simple probble fist of all did you complie wxwidget on the form like they say in installtion forms at

http://www.codeblocks.org/index.php?name=PNphpBB2&file=viewtopic&t=270

This would give you the need files.  Just rember when you do this add  the gcc compiler(gcc.exe) dir to your path.  Then use there template in codeblocks for wxwidgets.  Don't forget to select dynamic.  If you want static you have to read wxwidgets install.txt .

If you can't find gcc.exe you download the wrong version of C:B download the one that contane it read what they have there it sayes witch one has it.

Offline frog-o

  • Multiple posting newcomer
  • *
  • Posts: 61
Help setting up wxWidgets
« Reply #13 on: May 20, 2005, 02:35:21 pm »
One more thing don't feel stupid on programing.   It is very common for pepole to have problem when starting out add I am verry glade to help.

Offline frog-o

  • Multiple posting newcomer
  • *
  • Posts: 61
Help setting up wxWidgets
« Reply #14 on: May 20, 2005, 02:41:50 pm »
Sorry I forgot you are use microsoft. This is for gcc but you might want to try Gcc first it would make you life easer.   Want i was trying to say above you need to get wxwidget and compile so you have the needed(.lib or (.a if use gcc ming)) files or you can't program with it.  WxWidget is not include with codeblock it is another program.