Ok how can I build a Programm with wxWidgets

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

Ok, little stupid problem:
I have easily installed wxWidgets. It's version 3.1.2
But I'm not in the situation to compile a Program like the first step showed in this manual page:
https://docs.wxwidgets.org/trunk/overvi ... world.html

It's this header:

Code: Select all

// wxWidgets "Hello World" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
    #include <wx/wx.h>
#endif
And it's this error message:

Code: Select all

Meintest.c++:3:10: fatal error: wx/wxprec.h: Datei oder Verzeichnis nicht gefunden
 #include <wx/wxprec.h>
          ^~~~~~~~~~~~~
compilation terminated.

I think I must give the full pfade to my wxprec.h Header File.
But I'm not knowing this pfade, has anybody a sugestion to me what I'm doing wrong.

Thanks in advance:
Mungo1981
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Ok how can I build a Programm with wxWidgets

Post by doublemax »

You should start by building wxWidgets itself first and then build the "minimal" sample from the "samples" directory.

How to do that exactly depends on your platform and compiler which you didn't mention.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

Ok, I think I have install wxWidgets because of:

Code: Select all

wx-config --version
3.1.2
So in future information I'm using:
g++ as compiler
on:
Linux Ubuntu Studio

And I have seen the directory of:
WXWidgets/wxWidgets-3.1.2/samples/dialogs/dialogs.cpp
but there a lot of files,
and it gives make-files xml-files and some thing more,
please can you give me advises how to test such a sample-project ???
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

< Ok stop my last post>
I'm seem to be stupid.
The way to test the wxWidgets system is easily:

Code: Select all

cd xxx
make
./xxx
So this will run in a all susses way. But I need it to run my own code.
Have you a idea of the right way to call g++ with wxWidgets.
And or any Examples which run directly throught g++ so i can see the building process which will be for my own projects.
Last edited by Mungo1981 on Wed Jan 30, 2019 7:11 pm, edited 1 time in total.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Ok how can I build a Programm with wxWidgets

Post by ONEEYEMAN »

Hi,
Since version 3.1.2 is not in the repository I think you just unpacked the source code inside the wxWidgets folder. Am I right?

If I am, you should build the library first according to the documentation:

1. cd wxWidgets
2. mkdir buildLinux
3. cd buildLinux
4. ../configure --enable-debug --with-gtk=3
5. make

Then do this:

6. cd samples/minimal
7. make
8. ./minimal

If the minimal sample runs fine then you can use the library in your development.

Thank you.
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

yes this will run in full susses.
So I'm thinking its the problem how to call g++ with it.
ok it must something like:

Code: Select all

g++ Meintest.c++ 'wx-config' -o Test
but that's not right. But I'm to stupid to understand my silly little error which I'm have done.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Ok how can I build a Programm with wxWidgets

Post by doublemax »

I don't work under Linux, but from <wxdir>/docs/gtk/install.md

Code: Select all

The simplest program
----------------------

Now create your super-application myfoo.cpp and compile anywhere with

    g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
Note the backticks around the wx-config call.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

g++ myfoo.cpp `wx-config --libs --cxxflags` -o myfoo
ok this I would try. But I think -libs and -cxxflags are not to type 1:1 as Text, but must paste with any Value.
And I not so good in englisch, you will see by my Posts.
And so I'm not knew this value.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Ok how can I build a Programm with wxWidgets

Post by doublemax »

But I think -libs and -cxxflags are not to type 1:1 as Text, but must paste with any Value.
No. Execute "wx-config --libs --cxxflags" in the console and you'll see what it does.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

Ok, and this is what it will do:

Code: Select all

creco@creco-HP-250-G4-Notebook-PC:~/C++GUI/TestForWxwidgets$ g++ Meintest.c++ 'wx-config --libs --cxxflags' -o Test
g++: error: wx-config --libs --cxxflags: Datei oder Verzeichnis nicht gefunden
creco@creco-HP-250-G4-Notebook-PC:~/C++GUI/TestForWxwidgets$ 
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Ok how can I build a Programm with wxWidgets

Post by doublemax »

Like i said, the backticks are important ` not '

`wx-config --libs --cxxflags` executes the command wx-config --libs --cxxflags and replaces the expression with its output.
Use the source, Luke!
Mungo1981
Experienced Solver
Experienced Solver
Posts: 86
Joined: Wed Jan 30, 2019 5:42 pm

Re: Ok how can I build a Programm with wxWidgets

Post by Mungo1981 »

Ok,
very much thanks.
Just it will run in susses.

:) :o :D

Mungo1981
Post Reply