Page 1 of 1

Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 6:11 pm
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

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 6:37 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:00 pm
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 ???

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:06 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:09 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:12 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:28 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:34 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:38 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 7:42 pm
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$ 

Re: Ok how can I build a Programm with wxWidgets

Posted: Wed Jan 30, 2019 8:12 pm
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.

Re: Ok how can I build a Programm with wxWidgets

Posted: Thu Jan 31, 2019 5:33 pm
by Mungo1981
Ok,
very much thanks.
Just it will run in susses.

:) :o :D

Mungo1981