first wxdataviewmodel
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
first wxdataviewmodel
I am attempting to write my first wxdataviewmodel.
I am using codeblocks 10.5 with wxwidgets 2.8.
I have a file created with this code:
//MYLTYPE
#ifndef MYLTYPE_H
#define MYLTYPE_H
#include <wx/dataview.h>
class myltype: public wxDataViewModel
{
}
#endif
the error i am getting is:
/home/aj/bdn/myltype.h|7|error: expected class-name before ‘{’ token|
/usr/include/stdlib.h|35|error: expected unqualified-id before string constant|
/usr/include/c++/4.6/exception|37|error: expected declaration before end of line|
||=== Build finished: 3 errors, 0 warnings ===|
I am using codeblocks 10.5 with wxwidgets 2.8.
I have a file created with this code:
//MYLTYPE
#ifndef MYLTYPE_H
#define MYLTYPE_H
#include <wx/dataview.h>
class myltype: public wxDataViewModel
{
}
#endif
the error i am getting is:
/home/aj/bdn/myltype.h|7|error: expected class-name before ‘{’ token|
/usr/include/stdlib.h|35|error: expected unqualified-id before string constant|
/usr/include/c++/4.6/exception|37|error: expected declaration before end of line|
||=== Build finished: 3 errors, 0 warnings ===|
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
no clue, but i created the class using File | New Class and it compiles now.
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
hmm as soon as i add the inheritance : wxDataViewModel
i get the error.
i get the error.
Re: first wxdataviewmodel
Can you build the "dataview" sample that comes with wxWIdgets?
Check the value of wxUSE_DATAVIEWCTRL. Maybe the control is disabled in your build.
Check the value of wxUSE_DATAVIEWCTRL. Maybe the control is disabled in your build.
Use the source, Luke!
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
no i cannot. I actually get the same error
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
g++ -c -o dataview_dataview.o -I. `wx-config --cxxflags` -MTdataview_dataview.o -MF`echo dataview_dataview.o | sed -e 's,\.o$,.d,'` -MD -MP dataview.cpp
dataview.cpp:42:1: error: expected class-name before ‘{’ token
2 dataview.cpp:140:1: error: expected class-name before ‘{’ token
3 dataview.cpp:169:20: error: ‘wxDataViewListModel’ has not been declared
4 dataview.cpp: In constructor ‘MyCustomRenderer::MyCustomRenderer()’:
5 dataview.cpp:143:9: error: class ‘MyCustomRenderer’ does not have any field named ‘wxDataViewCustomRenderer’
6 dataview.cpp:143:50: error: ‘wxDATAVIEW_CELL_ACTIVATABLE’ was not declared in this scope
7 dataview.cpp: At global scope:
.....
dataview.cpp:42:1: error: expected class-name before ‘{’ token
2 dataview.cpp:140:1: error: expected class-name before ‘{’ token
3 dataview.cpp:169:20: error: ‘wxDataViewListModel’ has not been declared
4 dataview.cpp: In constructor ‘MyCustomRenderer::MyCustomRenderer()’:
5 dataview.cpp:143:9: error: class ‘MyCustomRenderer’ does not have any field named ‘wxDataViewCustomRenderer’
6 dataview.cpp:143:50: error: ‘wxDATAVIEW_CELL_ACTIVATABLE’ was not declared in this scope
7 dataview.cpp: At global scope:
.....
Re: first wxdataviewmodel
This probably means that dataviewcontrol is not enabled in your wxWidgets libraries. (Check the value of wxUSE_DATAVIEWCTRL). Did you build them yourself?
Use the source, Luke!
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
I am a newb. how do i test that variable.
As a side note i have noticed that if I put
#include "wx/generic/dataview.h"
in my header area i am able to get past that error, but stop at another error trying to complile the sample dataview.h.
Is this a setting in wx that i need to change so it grabs ALL the generic headers?
I did try to install wxwidgets 3.0, but then i deleted it and just reinstalled 2.8 through synaptic.
As a side note i have noticed that if I put
#include "wx/generic/dataview.h"
in my header area i am able to get past that error, but stop at another error trying to complile the sample dataview.h.
Is this a setting in wx that i need to change so it grabs ALL the generic headers?
I did try to install wxwidgets 3.0, but then i deleted it and just reinstalled 2.8 through synaptic.
Re: first wxdataviewmodel
Put this at the beginning of your code and compile. If wxUSE_DATAVIEWCTRL is not defined, you should get the error message.
I'd suggest to grab the wx3.0.0 sources and build the libraries yourself.
Code: Select all
#if !wxUSE_DATAVIEWCTRL
#error wxDataViewCtrl not available
#endif
Use the source, Luke!
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
i had to manually eliminate the remnants of the 3.0 I installed.
the uninstall did not totally get rid of it.
the uninstall did not totally get rid of it.
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
ok i have tried to download the gtk version of wxwidgets3.0.0.
I am running ubuntu 12.04 lte
I attempated to build it myself and install it according to directions in the doc folder.
I still could not compile dataview.cpp
here is the output of make
g++ -c -o dataview_dataview.o -I. `wx-config --cxxflags` -MTdataview_dataview.o -MF`echo dataview_dataview.o | sed -e 's,\.o$,.d,'` -MD -MP dataview.cpp
/bin/sh: 1: wx-config: not found
dataview.cpp:12:4: error: #error wxDataViewCtrl not available
dataview.cpp:15:23: fatal error: wx/wxprec.h: No such file or directory
compilation terminated.
make: *** [dataview_dataview.o] Error 1
I am running ubuntu 12.04 lte
I attempated to build it myself and install it according to directions in the doc folder.
I still could not compile dataview.cpp
here is the output of make
g++ -c -o dataview_dataview.o -I. `wx-config --cxxflags` -MTdataview_dataview.o -MF`echo dataview_dataview.o | sed -e 's,\.o$,.d,'` -MD -MP dataview.cpp
/bin/sh: 1: wx-config: not found
dataview.cpp:12:4: error: #error wxDataViewCtrl not available
dataview.cpp:15:23: fatal error: wx/wxprec.h: No such file or directory
compilation terminated.
make: *** [dataview_dataview.o] Error 1
-
- Experienced Solver
- Posts: 81
- Joined: Sun Dec 08, 2013 3:50 am
Re: first wxdataviewmodel
Is there some place that i can check that this is enabled in my download of wxWidgets3.0.0?
I see this on an old post from 08
http://ubuntuforums.org/archive/index.php/t-937810.html
optional:
--enable-dataviewctrl use wxDataViewCtrl class
I see this on an old post from 08
http://ubuntuforums.org/archive/index.php/t-937810.html
optional:
--enable-dataviewctrl use wxDataViewCtrl class
Re: first wxdataviewmodel
wxDataViewCtrl should be enabled by default in wx 3.0.
Try to stick with the samples and building using the makefile.
After you build the wx libraries, there is a generated setup.h where you could also check the value of wxUSE_DATAVIEWCTRL. Let's assume you created a directory "build-debug" in the wxWidgets source directory. Then the setup.h would be in <wxdir>/build-debug/lib/wx/include/<build-name>/wx/setup.h
Try to stick with the samples and building using the makefile.
After you build the wx libraries, there is a generated setup.h where you could also check the value of wxUSE_DATAVIEWCTRL. Let's assume you created a directory "build-debug" in the wxWidgets source directory. Then the setup.h would be in <wxdir>/build-debug/lib/wx/include/<build-name>/wx/setup.h
Use the source, Luke!