2
votes

The wxWidgets hello world example does not provide sufficient information to build wxWidgets in any one particular environment.

The Code::Blocks wxWidgets hello world example does provide sufficient information, but it does not seem likely that a newbie, or even a quite sophisticated user, could figure out all the necessary steps on their own, because there are arcane magic words required.

The Code Yarns example uses CMake, thus could run in many particular environments, but seems to assume that you have already set up wxWidgets and compiled it for your particular environment, and there does not seem to be a CMakeLists.txt file to compile wxWidgets for your particular environment.

wxWidgets is supposed to be cross platform and cross environment, and I am trying to set up a project to compile in several environments: on Windows10 Visual Studio, Windows 10 TDM-GCC, Windows 10 Code::Blocks, Ubuntu Code::Blocks, and Ubuntu 10 gcc.

And apart from the Code::Blocks environments, having trouble. Apart from Code::Blocks, I cannot find "Hello World" examples that actually set up wxWidgets on the target so that the Hello World will actually compile and run.

The wxWidgets samples directory is not particularly useful, since the samples assume an environment, and do not describe setting up that environment and the actions that will cause the sample to build and run.

4
What is a question? Do you ask for another guide? If so, this is off-topic on Stack Overflow. Take any of the existing guide, and try to follow it. If some step causes a problem, ask about specific step and specific problem (but try to google it before asking).Tsyvarev
@studie, you don't have to install anything. Just build the library and start developing.Igor
@studie, you question seems very weird. The instructions to build the sampple does not have anything to do with the instructions to build the library. I'm glad you found what you are looking for, but in the future you need to specify exactly what you are looking for. Thank you.Igor

4 Answers

1
votes

Installation guide

I know this is a old question but I struggled really hard to find a guide for an installation on wxwidgets. You can use the vckpg importer by Microsoft. Make sure you have git installed before you follow this routine. I will write this for Windows with Visual Studio 2017:

  1. Clone the following repository to a directory of your choice: git clone https://www.github.com/Microsoft/vcpkg
  2. Then open up powershell (ps) (run it as admin) and navigate to the cloned vcpkg folder
  3. Now in ps, while you are in the vcpkg folder run the following command \.vcpkg integrate install so we have a user-wide integration of the vcpkg paket manager and can #include libraries in our c++ projects

  4. Now to install wxwidgets 32-Bit run \.vcpkg install wxwidgets --triplet x86-windows. For the 64-Bit Version run \.vcpkg install wxwidgets --triplet x64-windows

  5. Now open up the properties of your project in Visual Studio.
  6. For the integration of the 64-Bit wxwidgets version choose all configurations and as plattform x64. Then go to C/C++ -> General -> Additional Include Directories and add the following folderpath YOUR_FOLDER_PATH\vcpkg\packages\wxwidgets_x64-windows\include;YOUR_FOLDER_PATH\vcpkg\packages\wxwidgets_x64-windows\lib. Do the same for the x86 configuration but with the wxwidgets_x86-windows folderpath instead.
  7. As a last step go to in the properties under C/C++ -> Preprocessor and under the point Preprocessordefinition add the following as extra point WXUSINGDLL=1 (do it for the x64 and for the x86 plattform configuration if you want to use both)

Now you should be able to use the library and run the hello world project.

0
votes

To build an app, first you need to have the library compiled. To achieve that you can get precompiled binaries or the sources (see Downloads) and compile them yourself (see Building).

Instructions might still not be perfect for everyone, and you are welcome to improve them - even call it your first contribution ;)

0
votes

The installation instructions that I was looking for are to be found in wxWidgets/docs/install.txt

0
votes

There are multiple ways to setup wxWidgets on Windows and use it in a project. If your project is going to use CMake there are 2 main options (other than compiling stuff yourself some other way):

  1. Use vcpkg - which, in theory, is the easiest, but I couldn't get it to work (in time). Here is some info on that: https://www.wxwidgets.org/blog/2019/01/wxwidgets-and-vcpkg/ The problem is find_package couldn't find the package, so then I just went to 2:
  2. Download the lastest compiled headers, libs & bins from the wxwidgets and put them in a folder like c:/wxwidgets. Then, in your Cmake file, before the call to find_package, do:

SET(wxWidgets_ROOT_DIR "c:/wxwidgets/")

SET(wxWidgets_LIB_DIR "c:/wxwidgets/lib/vc14x_x64_dll")

SET(wxWidgets_CONFIGURATION "mswd")

The LIB_DIR is using VS2019 x64 in my case. mswd just means build this for Debug

Finally, when adding the executable, do not forget the WIn32:

add_executable(membot WIN32 ${project_SRCS})

P.S.: Remember to extract the headers include folder near the lib.