Page 1 of 2

Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 4:25 pm
by Mungo1981
Dear, Community,
I have following Problem I will try to solve:
I need a Function who automatically add some Strings/Points-of-Choices to a ComboBox.
I think I can solve this by a Function in a Object/Class.
So I only need a unsorted Set in this Class.
Give my data in a Object of this Class,
Use my function which will iterate over this Set.
And append the Strings in this Set in the wxComboBox.
So you could think, I need a Parameter of this Function,
where I say this Function to which wxComboBox the strings should append.

So when there out is nothing who think he find a better way.
I need the #include <wx/combobox.h> in my Class Header.
But:
Every time I try this, I have errors in classes I never heard before of them.
So is there a workaround or some thing I could do better ???

Mungo1981

Re: Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 5:26 pm
by doublemax
Try including <wx/wx.h> before any other wx header.

If that doesn't fix it, show the error messages you get.

Re: Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 5:31 pm
by Mungo1981
Ok, I have try what you say,
here are my ErrorCodes:

Code: Select all

||=== Build: Debug in Test100 (compiler: GNU GCC Compiler) ===|
/usr/local/include/wx-3.1/wx/object.h|361|Nicht definierter Verweis auf `wxObject::Ref(wxObject const&)'|
/usr/local/include/wx-3.1/wx/thread.h|291|Nicht definierter Verweis auf `wxMutex::Lock()'|
/usr/local/include/wx-3.1/wx/thread.h|293|Nicht definierter Verweis auf `wxMutex::Unlock()'|
/usr/local/include/wx-3.1/wx/window.h|525|Nicht definierter Verweis auf `wxWindowBase::GetBestSize() const'|
/usr/local/include/wx-3.1/wx/window.h|738|Nicht definierter Verweis auf `wxWindowBase::IsEnabled() const'|
/usr/local/include/wx-3.1/wx/window.h|870|Nicht definierter Verweis auf `wxEvtHandler::ProcessEventLocally(wxEvent&)'|
/usr/local/include/wx-3.1/wx/window.h|1032|Nicht definierter Verweis auf `wxWindowBase::GetCapture()'|
/usr/local/include/wx-3.1/wx/window.h|1113|Nicht definierter Verweis auf `wxWindowBase::GetClassDefaultAttributes(wxWindowVariant)'|
/usr/local/include/wx-3.1/wx/window.h|1817|Nicht definierter Verweis auf `wxDefaultSize'|
/usr/local/include/wx-3.1/wx/mdi.h|336|Nicht definierter Verweis auf `wxWindow::wxWindow()'|
/usr/local/include/wx-3.1/wx/gtk/mdi.h|141|Nicht definierter Verweis auf `vtable for wxMDIClientWindow'|
/usr/local/include/wx-3.1/wx/mdi.h|396|Nicht definierter Verweis auf `wxEVT_MENU'|
/usr/local/include/wx-3.1/wx/mdi.h|397|Nicht definierter Verweis auf `wxEVT_UPDATE_UI'|
/usr/local/include/wx-3.1/wx/mdi.h|406|Nicht definierter Verweis auf `wxWindowBase::IsDescendant(wxWindowBase*) const'|
/usr/local/include/wx-3.1/wx/mdi.h|414|Nicht definierter Verweis auf `wxWindowBase::TryBefore(wxEvent&)'|
/usr/local/include/wx-3.1/wx/event.h|213|Nicht definierter Verweis auf `wxEventFunctor::~wxEventFunctor()'|
/usr/local/include/wx-3.1/wx/thread.h|655|Nicht definierter Verweis auf `wxThread::~wxThread()'|
||=== Build failed: 17 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|

Re: Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 5:33 pm
by doublemax
Is this inside a wxWidgets application that compiles otherwise?

Re: Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 5:47 pm
by Mungo1981
Yes,
its out my old MMA Music Composition Program.
With your help it run just easy and stable.
But I have had to change some thing.
It now has a ComboBox in the Panel
- you remember the old Problem with the first try Frame.
So this ComboBox should hold the Names of all Sequences.
And I think it calls me like a object who hold this data, and put it in the ComboBox.

Re: Short Problem with #include <wx/combobox.h>

Posted: Sun Mar 10, 2019 6:13 pm
by doublemax
Please show the beginning of the file that has all #includes.

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 5:41 pm
by Mungo1981
Ok,
I'm late but here is the Information.

Code: Select all

#ifndef SEQSBASKET_H
#define SEQSBASKET_H

#include <wx/wx.h>
#include <wx/combobox.h>


class SeqsBasket
{
    public:
        SeqsBasket();
        virtual ~SeqsBasket();
        void setComboBox(wxComboBox* box);
    protected:
    private:
};

#endif // SEQSBASKET_H
I'm was ill to high Diabetes about 400mg/dL.
So I could answer not earlier than just.
:( :o :(

So I have run Code::Blocks
And so he capitulate not easy, he show me the Error-Messages I have show you.
I will repeat this Error-Messages here:

Code: Select all

||=== Build: Debug in Test100 (compiler: GNU GCC Compiler) ===|
/usr/local/include/wx-3.1/wx/object.h|361|Nicht definierter Verweis auf `wxObject::Ref(wxObject const&)'|
/usr/local/include/wx-3.1/wx/thread.h|291|Nicht definierter Verweis auf `wxMutex::Lock()'|
/usr/local/include/wx-3.1/wx/thread.h|293|Nicht definierter Verweis auf `wxMutex::Unlock()'|
/usr/local/include/wx-3.1/wx/window.h|525|Nicht definierter Verweis auf `wxWindowBase::GetBestSize() const'|
/usr/local/include/wx-3.1/wx/window.h|738|Nicht definierter Verweis auf `wxWindowBase::IsEnabled() const'|
/usr/local/include/wx-3.1/wx/window.h|870|Nicht definierter Verweis auf `wxEvtHandler::ProcessEventLocally(wxEvent&)'|
/usr/local/include/wx-3.1/wx/window.h|1032|Nicht definierter Verweis auf `wxWindowBase::GetCapture()'|
/usr/local/include/wx-3.1/wx/window.h|1113|Nicht definierter Verweis auf `wxWindowBase::GetClassDefaultAttributes(wxWindowVariant)'|
/usr/local/include/wx-3.1/wx/window.h|1817|Nicht definierter Verweis auf `wxDefaultSize'|
/usr/local/include/wx-3.1/wx/mdi.h|336|Nicht definierter Verweis auf `wxWindow::wxWindow()'|
/usr/local/include/wx-3.1/wx/gtk/mdi.h|141|Nicht definierter Verweis auf `vtable for wxMDIClientWindow'|
/usr/local/include/wx-3.1/wx/mdi.h|396|Nicht definierter Verweis auf `wxEVT_MENU'|
/usr/local/include/wx-3.1/wx/mdi.h|397|Nicht definierter Verweis auf `wxEVT_UPDATE_UI'|
/usr/local/include/wx-3.1/wx/mdi.h|406|Nicht definierter Verweis auf `wxWindowBase::IsDescendant(wxWindowBase*) const'|
/usr/local/include/wx-3.1/wx/mdi.h|414|Nicht definierter Verweis auf `wxWindowBase::TryBefore(wxEvent&)'|
/usr/local/include/wx-3.1/wx/event.h|213|Nicht definierter Verweis auf `wxEventFunctor::~wxEventFunctor()'|
/usr/local/include/wx-3.1/wx/thread.h|655|Nicht definierter Verweis auf `wxThread::~wxThread()'|
||=== Build failed: 17 error(s), 0 warning(s) (0 minute(s), 5 second(s)) ===|
So I have seen in the Code he points he has an Error.
So I can see, he should call a Function Ref().

Code: Select all

 wxObject& operator=(const wxObject& other)
    {
        if ( this != &other )
        {
            Ref(other);
        }
        return *this;
    }

    bool IsKindOf(const wxClassInfo *info) const;
So I think it could be an Error I have build on the first thing I had to do.
I think it could be an Error by the installation on wxWidgets.

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 5:54 pm
by doublemax
Normally i'd say there's a problem with the wxWidgets or CB configuration. But as you've said this is inside a wx app that compiles without the new changes, i have no clue what the problem could be.

Can you show the beginning of the .cpp file where "SeqsBasket.h" (or how it's called) gets included?

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 6:49 pm
by Mungo1981
Here are the x.cpp:

Code: Select all

#include <wx/combobox.h>
#include "SeqsNameBasket.h"

SeqsNameBasket::SeqsNameBasket()
{
    //ctor
}

SeqsNameBasket::~SeqsNameBasket()
{
    //dtor
}

void SeqsNameBasket::setComboBox(wxComboBox box)
{

}
You can see I have modify the Code a little bit,:
So I become lesser Error Messages:

Code: Select all

||=== Build: Debug in Test100 (compiler: GNU GCC Compiler) ===|
/usr/local/include/wx-3.1/wx/thread.h|291|Nicht definierter Verweis auf `wxMutex::Lock()'|
/usr/local/include/wx-3.1/wx/thread.h|293|Nicht definierter Verweis auf `wxMutex::Unlock()'|
/usr/local/include/wx-3.1/wx/event.h|213|Nicht definierter Verweis auf `wxEventFunctor::~wxEventFunctor()'|
/usr/local/include/wx-3.1/wx/thread.h|655|Nicht definierter Verweis auf `wxThread::~wxThread()'|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|


And this my x.h::

Code: Select all

#ifndef SEQSNAMEBASKET_H
#define SEQSNAMEBASKET_H


class SeqsNameBasket
{
    public:
        SeqsNameBasket();
        virtual ~SeqsNameBasket();
        void setComboBox(wxComboBox box);
    protected:
    private:
};

#endif // SEQSNAMEBASKET_H

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 6:58 pm
by doublemax

Code: Select all

#include <wx/combobox.h>
#include "SeqsNameBasket.h"
As i said, you need to include "wx/wx.h" before any other wx include.

And the x.h is different from the one you posted earlier.

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 7:50 pm
by Mungo1981
Ok,
I have included include "wx/wx.h"
But it will give me the first set of Errors.

Re: Short Problem with #include <wx/combobox.h>

Posted: Mon Mar 11, 2019 8:04 pm
by doublemax
I assume you can build the "minimal" sample that comes with wxWidgets?

If yes, copy the following header file into the directory and include it after this block:

Code: Select all

#ifndef WX_PRECOMP
    #include "wx/wx.h"
#endif

#include "SeqsNameBasket.h" // <- new line

Code: Select all

#ifndef SEQSBASKET_H
#define SEQSBASKET_H

#include <wx/wx.h>
#include <wx/combobox.h>

class SeqsBasket
{
    public:
        SeqsBasket();
        virtual ~SeqsBasket();
        void setComboBox(wxComboBox* box);
    protected:
    private:
};

#endif // SEQSBASKET_H

Re: Short Problem with #include <wx/combobox.h>

Posted: Tue Mar 12, 2019 5:40 pm
by Mungo1981
Ok,
Just I have try your last recommendation,
and now the Code would compile graceful.
I'm have this evening to much to do.
Cleaning my Home, Cleaning my Computer ....
So I would think I will check how it works tomorrow.
But just I can say you my very thanks,
and my esteem.

So with very much thanks:
:D 8) :D
Mungo1981

Re: Short Problem with #include <wx/combobox.h>

Posted: Tue Mar 12, 2019 7:51 pm
by Mungo1981
So,
I find this could be the solution.
But what is the magical Difference.
Why it works now, but nothing before.
Can you please tell it me, so I will be in the power to repeat it by my self in the Future.
:roll: :roll: :roll:

Re: Short Problem with #include <wx/combobox.h>

Posted: Tue Mar 12, 2019 9:33 pm
by doublemax
So you're saying that this now also works in your project, not only the "minimal" sample?

I think in the end, the problem always was that you used "wx/combox.h" before "wx/wx.h" was included. Including wx.h first is important, because it sets a lot of build and platform related #defines that are used in all other include files.

But as i never had the complete picture of your code, i can only guess.