Downloaded samples from www.wxwidget.org are not working Topic is solved
Downloaded samples from www.wxwidget.org are not working
I have downloaded the wxwidget samples from www.wxwidget.org download section and the release I download is stable release. I build and install as per given in install_gtk.txt file.
After building I tried to compile and run a sample given in sample folder. But all of them giving errors. Initial errors are not correct path of headers included.
Do I need to do some change in path or need to configure something before I run and sample or my own application.
Regards
Gunjan
After building I tried to compile and run a sample given in sample folder. But all of them giving errors. Initial errors are not correct path of headers included.
Do I need to do some change in path or need to configure something before I run and sample or my own application.
Regards
Gunjan
Hi,
What you should have done for e.g. the 'minimal' sample, was to cd to buildgtk/samples/minimal/ and then run 'make'.
The 'simplest program' instructions apply to your own programs. If you get problems with those, the first thing to do is to run 'wx-config --list' and examine the output.
Regards,
David
Do you mean one of the wxWidgets source packages? If so, which one?I have downloaded the wxwidget samples
That probably means the answer to my first question is 'Yes' . Which bit of the install_gtk.txt advice did you follow? The "simplest case" with ../configure --with-gtk, or one of the others?I build and install as per given in install_gtk.txt file.
Which sample folder, and how did you try to compile?After building I tried to compile and run a sample given in sample folder
What you should have done for e.g. the 'minimal' sample, was to cd to buildgtk/samples/minimal/ and then run 'make'.
The 'simplest program' instructions apply to your own programs. If you get problems with those, the first thing to do is to run 'wx-config --list' and examine the output.
Regards,
David
Hi,
Thanks for your quick reply.
I have downloaded 2.8.11 version of wxWidget source packages.
Yes I have followed the simplest case with ../configure --with-gtk in Linux system.(Working on fedora 9.0)
After successfully doing above , I tried to build and run an example as you told i.e. ( e.g. the 'minimal' sample, was to cd to buildgtk/samples/minimal/ and then run 'make'.)
Now I am able to make and run.
But if I want to make my own new project suppose myapp.cpp anywhere in my system and want to compile it with wxWidget,then how can I do that?
Regards
Gunjan
Thanks for your quick reply.
I have downloaded 2.8.11 version of wxWidget source packages.
Yes I have followed the simplest case with ../configure --with-gtk in Linux system.(Working on fedora 9.0)
After successfully doing above , I tried to build and run an example as you told i.e. ( e.g. the 'minimal' sample, was to cd to buildgtk/samples/minimal/ and then run 'make'.)
Now I am able to make and run.
But if I want to make my own new project suppose myapp.cpp anywhere in my system and want to compile it with wxWidget,then how can I do that?
Regards
Gunjan
Hi!
Like
g++ -otest myapp.cpp `wx-config --libs --cxxflags`
Check wx-config options. It's quite a mighty script that allows you to skip between different wxWidgets versions (if installed) and choose debug and release libs.
If you did "make install" for wxWidgets it's quite simple: use wx-config.gunjan wrote:But if I want to make my own new project suppose myapp.cpp anywhere in my system and want to compile it with wxWidget,then how can I do that?
Like
g++ -otest myapp.cpp `wx-config --libs --cxxflags`
Check wx-config options. It's quite a mighty script that allows you to skip between different wxWidgets versions (if installed) and choose debug and release libs.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
If you did 'make install' after you compiled wxGTK (assuming you configured without --prefix=<somewhere else>) then you installed to /usr/local/, and wx-config will be in /usr/local/bin. Perhaps that isn't in your PATH. Try using the full filepath to wx-config.
If you installed to somewhere else, then the same applies.
BTW, you can instead do, in your terminal:
PATH=/full/path/to/wherever/you/installed/wx-config/:$PATH
and then use g++ `wx-config --libs --cxxflags` <etc> as normal.
If you installed to somewhere else, then the same applies.
BTW, you can instead do, in your terminal:
PATH=/full/path/to/wherever/you/installed/wx-config/:$PATH
and then use g++ `wx-config --libs --cxxflags` <etc> as normal.
Really? How strange: there is one on my fedora 9 virtualbox guest.Also there is no /usr/local/ folder
If its database is populated, the easiest way to find the installed wx-config is:
locate wx-config
If 'locate' complains, the slower alternative is to become root, then do:
find / -name wx-config
If it turns out that the only wx-config is the one in buildgtk/ then I suggest you configure again:
../configure --prefix=/usr
I think you'll not need to make clean, but can use the old build. su to root, make install and ldconfig. You should then have a working wx-config in your PATH.
I can see wx-config in /usr/local/bin of my fedora(previously i thought that it will be inside wxWidget folder) , but still if i use g++ myapp.cpp '/usr/local/bin/wx-config --libs --cxxflags' -o test. It is giving same error i.e. "g++:wx-config --libs --cxxflags: No such files or directory".
After this error other errors came for headers inclusion path like "myapp.cpp:6:20: error: wx/wx.h: No such file or directory"
After this error other errors came for headers inclusion path like "myapp.cpp:6:20: error: wx/wx.h: No such file or directory"
Earlier you wrote:
If you still were using backticks, please post the output of doing (in a terminal, no backticks required):
wx-config --libs --cxxflags
This time you wrote:I tried
g++ -o test myapp.cpp `wx-config --libs --cxxflags`
but it didn't worked stating that -> g++ :wx-config --libs -cxxflags: No such file or directory.
You must use backticks:`...` not single-quotes:'...'. Backticks say: "Run this command and use the resulting output". So `wx-config --libs --cxxflags` will be replaced by the list of wx libraries and compilation flags.but still if i use g++ myapp.cpp '/usr/local/bin/wx-config --libs --cxxflags' -o test. It is giving same error
If you still were using backticks, please post the output of doing (in a terminal, no backticks required):
wx-config --libs --cxxflags
Wow, did your app really take 18 days to build?I used backticks and able to compile successfullt and an exe is made.
That's a standard problem with some distros, that don't look for shared libs in /usr/local/lib.But when I ran the exe by command ./exename , it is giving error -> "error while loading shared libraries: libwx_gtk2u_xrc-2.9.so.1 :cannot open shared object file or directory"
The quick answer is to do this in each terminal:
Code: Select all
export LD_LIBRARY_PATH=/usr/local/lib
./exename
export LD_LIBRARY_PATH=/usr/local/lib
to your ~/.bashrc
If I want to make exe in two steps. First make object and then link it. then how can i do this.
e.g. g++ -c test.cpp `/usr/local/bin/wx-config --libs --cxxflags` will generate test.o and now if i want to link it and make exe I will do g++ -o test test.o `/usr/local/bin/wx-config --libs --cxxflags`.
Is this correct or there is some more correcdt method of doing it.
Regards
Gunjan
e.g. g++ -c test.cpp `/usr/local/bin/wx-config --libs --cxxflags` will generate test.o and now if i want to link it and make exe I will do g++ -o test test.o `/usr/local/bin/wx-config --libs --cxxflags`.
Is this correct or there is some more correcdt method of doing it.
Regards
Gunjan
You only need `wx-config --cxxflags` for the compiling stage, and you only need `wx-config --libs` for the linking stage.
AFAIK it's correct, though I have little experience in using g++ direct from the commandline (most of the time nowadays there's a makefile). However you can easily find lots of information about g++ from the man page and internet.Is this correct or there is some more correct method of doing it.