LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-07-2010, 01:26 AM   #1
zozoR
LQ Newbie
 
Registered: Apr 2006
Location: Denmark!
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
Question C++ Compiling wx2.8.10 on 64-bit ubuntu


hi!

I went from mandriva 2009 32-bit to ubuntu 9.10 64-bit and wx begins to act up..

the simple program from the wx hello world tutorial build fine on my old system, but not my new on. I got the packages installed (wx2.8.10-dev, headers and whatnot)

I've looked around a bit and it seems the compiler is not including the files correctly..

Compiler command:
Code:
g++ k.cpp `wx-config --libs` `wx-config --cxxflags` -o morten
Compiler output sample (because most of it is because of first errors):
Code:
k.cpp:9: error: invalid use of incomplete type ‘struct wxFrame’
/usr/include/wx-2.8/wx/utils.h:50: error: forward declaration of ‘struct wxFrame’
k.cpp:12: error: ISO C++ forbids declaration of ‘wxPoint’ with no type
k.cpp:12: error: expected ‘,’ or ‘...’ before ‘&’ token
k.cpp:14: error: ‘wxCommandEvent’ has not been declared
k.cpp:15: error: ‘wxCommandEvent’ has not been declared
k.cpp:26: error: incomplete type ‘wxFrame’ used in nested name specifier
k.cpp:27: error: ‘wxCommandEventHandler’ was not declared in this scope
And the source, but i dont think thats needed:
Code:
#include "wx/wx.h"

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

class MyFrame: public wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()
};

enum
{
    ID_Quit = 1,
    ID_About,
};

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit,  MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool MyApp::OnInit()
{
    MyFrame *frame = new MyFrame(wxT("Hello World"), wxPoint(50, 50), wxSize(450, 340) );
    frame->Show(true);
    SetTopWindow(frame);
    return true;
}


MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
       : wxFrame(NULL, -1, title, pos, size)
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _("&About...") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _("Welcome to wxWidgets!") );
}

void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
    Close(true);
}

void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
    wxMessageBox( _("This is a wxWidgets Hello world sample"),
                  _("About Hello World"), 
                  wxOK | wxICON_INFORMATION, this );
}
I Hope you have any ideas on whats wrong
 
Old 03-08-2010, 11:13 AM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,107

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
I don't even know what wx is, but a google search for wxFrame was still easy and the documentation I found said you need

Code:
#include <wx/frame.h>
Your error messages tell me that you have included a full definition of wxApp but only a pre declaration of wxFrame. It seems reasonable to assume that is what you get by just using

Code:
#include "wx/wx.h"
Quote:
I went from mandriva 2009 32-bit to ubuntu 9.10 64-bit and wx begins to act up.
I'd rather not even guess what difference made it include the full definition of wxFrame when you had whatever version of wx installed on some other Linux. The documentation says you should include wx/frame.h when using wxFrame, so that seems to be the thing to do.

I'd also rather not guess any of the consequences of your use of "wx/wx.h" rather than the documentation suggested <wx/wx.h>. But maybe you should look at that as well.

Last edited by johnsfine; 03-08-2010 at 11:18 AM.
 
Old 03-09-2010, 08:57 AM   #3
zozoR
LQ Newbie
 
Registered: Apr 2006
Location: Denmark!
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
I think there is something wrong with the packages for wx on this ubuntu

After compiling the wx library myself, and linking to that one instead it worked fine

Maybe i should notify the ubuntu team?
 
Old 03-09-2010, 09:38 AM   #4
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,107

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
Quote:
Originally Posted by zozoR View Post
I think there is something wrong with the packages for wx on this ubuntu

After compiling the wx library myself, and linking to that one instead it worked fine

Maybe i should notify the ubuntu team?
Do what you like in that regard. I expect the Ubuntu team is used to seeing a lot of confused and incorrect problem reports.

I don't know enough about wx to have any opinion on whether there is an actual problem in Ubuntu's package for wx.

But when you use the phase "compiling the wx library myself, and linking to that one" for a problem that has nothing to do with the compiled portion of wx nor with (the likely meaning of) "linking", I have to assume you are still confused about the situation.

The problem, if there is one, would be in which headers are installed by the package and where they are installed, not with any binary (compiled) part of the package.

If you do ask the Ubuntu team about this problem, please include the URL of this thread in what you send them, both to give them context and so that if you get the attention of anyone competent to answer, they might post something helpful in this thread.

Last edited by johnsfine; 03-09-2010 at 09:41 AM.
 
Old 03-10-2010, 10:13 AM   #5
zozoR
LQ Newbie
 
Registered: Apr 2006
Location: Denmark!
Distribution: Ubuntu
Posts: 9

Original Poster
Rep: Reputation: 0
im pretty much no C++ guru. So i suppose i got the wrong words for what i mean.

when you compile something with wx you use the program wx-config with different commands to tell the compiler what it should be doing and whatnot.

now i just ran a diff on the different outputs from wx-config (/urs/local/bin/wx-config and just wx-config) and there is no difference..
I dont know what was wrong then.. but it got solved by compiling the wx library myself
 
Old 04-04-2010, 02:31 PM   #6
epikuros
LQ Newbie
 
Registered: Apr 2010
Location: Germany
Posts: 1

Rep: Reputation: 0
Hi,

I see the post has been quiet for a while, but I am posting a possible solution for people finding it through google like me.

It appears that, in Karmic, the libwxgtk* packages, needed to my understanding to render the GUI elements under X, are not a dependency of the general WX packages. Try installing them explicitely...

Good luck,
Epikuros

Last edited by epikuros; 04-04-2010 at 02:33 PM.
 
  


Reply

Tags
c++, error, g++, include


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
64 bit cpu-64 bit Ubuntu-are there 32 bit app issues? sofasurfer Ubuntu 7 04-09-2014 02:02 PM
LXer: Ubuntu 32-bit, 32-bit PAE, 64-bit Benchmarks LXer Syndicated Linux News 0 12-30-2009 11:00 AM
Compiling 32 bit sample program on 64 bit fedora using -m32 option pankajdev Linux - Newbie 2 10-07-2009 07:42 AM
compiling 32 bit application on 64 bit linux(x86_64) uttam_h Linux - Software 16 07-19-2008 02:33 PM
Compiling 32-bit binary in a 64-bit environment Kaj Linux - Software 1 12-13-2004 09:43 AM


All times are GMT -5. The time now is 03:34 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration