[SOLVED] Freshly compiled wxWidgets-3.1.5 not working

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
Slyde
Earned some good credits
Earned some good credits
Posts: 130
Joined: Mon Apr 09, 2018 11:08 pm

[SOLVED] Freshly compiled wxWidgets-3.1.5 not working

Post by Slyde »

I guess I'm just getting too old for this stuff. Hopefully I just made a mistake and this can be solved.

I used this line to compile wxWidgets.

Code: Select all

mingw32-make -f makefile.gcc SHARED=0 MONOLITHIC=0 BUILD=release
I wanted static libraries instead DLLs. Of course I have the system variable WXWIN set to C:\wxWindows-3-1.5, where I compiled it to.

So, after adjusting my CMake file that runs the same Program on Linux, I clicked run...and got this as it exited with errors.

My Windows 10 compiler is

Code: Select all

C:\wxWidgets-3.1.5\build\msw>gcc --version
gcc (MinGW-W64 i686-posix-dwarf, built by Brecht Sanders) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
And the screenshot shows I'm using the same one in my IDE.
Screenshot (14).png
What did I do wrong?
Last edited by Slyde on Wed Nov 17, 2021 4:08 pm, edited 1 time in total.
Linux Mint 21.3 | wxWidgets-3.2.4
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by PB »

Does wxWidgets_LIB_DIR in your CMakefile point to the correct location (instead of the DLL build folder), i.e. to

Code: Select all

C:\wxWindows-3-1.5\lib\gcc_lib
I would also make sure the build is clean.
Slyde
Earned some good credits
Earned some good credits
Posts: 130
Joined: Mon Apr 09, 2018 11:08 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by Slyde »

@PB - I just wiped everything out and started new. This is my CMake:

Code: Select all

cmake_minimum_required(VERSION 3.19)
project(Fisherman)

set(CMAKE_CXX_STANDARD 20)

set(wxWidgets_ROOT_DIR C:/wxWidgets-3.1.5)

set(wxWidgets_LIB_DIR C:/wxWindows-3-1.5/lib/gcc_lib)

find_package(wxWidgets REQUIRED core base)
set(wxWidgets_CONFIGURATION gcc_mswu)
include(${wxWidgets_USE_FILE})

set(SOURCE_FILES App.cpp)
add_executable(Fisherman
        App.cpp
        App.h
        Fishermen.cpp
        Fishermen.h
        sqlite3ext.h
        sqlite3.h
        sqlite3.c
        AddNewPerson.cpp
        AddNewPerson.h)

target_link_libraries(Fisherman ${wxWidgets_LIBRARIES})
Adding set(wxWidgets_ROOT_DIR C:/wxWidgets-3.1.5) resulted in

Code: Select all

"C:\Program Files\JetBrains\CLion 2020.2.4\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G "CodeBlocks - MinGW Makefiles" C:\Users\lands\OneDrive\Desktop\Fishermen\Fisherman2
CMake Error at C:/Program Files/JetBrains/CLion 2020.2.4/bin/cmake/win/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
  wxWidgets_INCLUDE_DIRS core base)
Call Stack (most recent call first):
  C:/Program Files/JetBrains/CLion 2020.2.4/bin/cmake/win/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/JetBrains/CLion 2020.2.4/bin/cmake/win/share/cmake-3.20/Modules/FindwxWidgets.cmake:1025 (find_package_handle_standard_args)
  CMakeLists.txt:10 (find_package)


-- Configuring incomplete, errors occurred!
See also "C:/Users/lands/OneDrive/Desktop/Fishermen/Fisherman2/cmake-build-debug/CMakeFiles/CMakeOutput.log".

[Failed to reload]
And if I comment out that line, I get the long list you saw from my pastebin post.

What more can I do? I actually need wxWidgets working for me on Windows more than on Linux (which works fine) atm.
Linux Mint 21.3 | wxWidgets-3.2.4
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by doublemax »

Try adding "--debug-output" to the cmake command. Maybe it gives some useful information.
Use the source, Luke!
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by stahta01 »

https://cmake.org/cmake/help/latest/mod ... dgets.html

The above implies this is wrong

Code: Select all

set(wxWidgets_CONFIGURATION gcc_mswu)
Likely it should be

Code: Select all

set(wxWidgets_CONFIGURATION mswu)
The above is just a guess on my part.

Tim S.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by PB »

Disclaimer: I have never used CLion nor am I any good with CMake.

CMake command line looks a bit odd to me. Firstly, you are using Release build of wxWidgets yet there is "-DCMAKE_BUILD_TYPE=Debug". Secondly, is using ""CodeBlocks - MinGW Makefiles" generator correct?
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by stahta01 »

Link that might help.

viewtopic.php?p=201055&sid=398b364b5655 ... 98#p201055

From link above.

Code: Select all

-DwxWidgets_FIND_STYLE:STRING="win32" -DwxWidgets_ROOT_DIR:STRING="C:/repos/git/wxWidgets" -DwxWidgets_LIB_DIR:STRING="C:/repos/git/wxWidgets/lib/gcc_lib" -DwxWidgets_CONFIGURATION="mswu"
You are missing the setting of "wxWidgets_FIND_STYLE" to "win32" this might be the cause.

Tim S.
Slyde
Earned some good credits
Earned some good credits
Posts: 130
Joined: Mon Apr 09, 2018 11:08 pm

Re: Freshly compiled wxWidgets-3.1.5 not working

Post by Slyde »

Thanks for all the input, everyone. I'd given up on this until yesterday, then, out of the blue, I decided I wasn't gonna let it whip me. So I logged out of Linux and came back here to Windows. And after chasing all the wrong answers to solve this, again, I looked in the cmake folder under the wxWidgets build directory. The readme file file instructed me to look at another readme file:

Code: Select all

C:\wxWidgets-3.1.5\docs\doxygen\overviews
That file provides this:

Code: Select all

Using find_package                     {#cmake_find_package}
------------------
You can use `find_package(wxWidgets)` to use a compiled version of wxWidgets.
Have a look at the [CMake Documentation](https://cmake.org/cmake/help/latest/module/FindwxWidgets.html)
for detailed instructions.

Your *CMakeLists.txt* would look like this:
~~~
...

find_package(wxWidgets REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})
add_executable(myapp myapp.cpp)
target_link_libraries(myapp ${wxWidgets_LIBRARIES})
~~~
The solution was right there all along, from the wxWidgets team. And after I doctored it up to fit my needs,

Code: Select all

cmake_minimum_required(VERSION 3.20)
project(Fishermen)

set(CMAKE_CXX_STANDARD 20)

find_package(wxWidgets REQUIRED COMPONENTS net core base)
include(${wxWidgets_USE_FILE})

set(SOURCE_FILES App.cpp)
add_executable(Fishermen
        App.cpp
        App.h
        Fishermen.cpp
        Fishermen.h
        AddNewPerson.cpp
        AddNewPerson.h
        sqlite3ext.h
        sqlite3.h
        sqlite3.c)

target_link_libraries(Fishermen ${wxWidgets_LIBRARIES})
it worked on the first run!

I know that not everyone will stumble out of the gate and embarrass themselves like I have. But in the unlikely event there are, maybe this will help them :D
Linux Mint 21.3 | wxWidgets-3.2.4
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: [SOLVED] Freshly compiled wxWidgets-3.1.5 not working

Post by ONEEYEMAN »

Hi,
ALWAYS!!! ALWAYS!!! ALWAYS!!! check with the official documentation first. ;-)

Thank you.
Slyde
Earned some good credits
Earned some good credits
Posts: 130
Joined: Mon Apr 09, 2018 11:08 pm

Re: [SOLVED] Freshly compiled wxWidgets-3.1.5 not working

Post by Slyde »

No no no. Thank you. Thank all of you. wxWidgets ROCK!
Linux Mint 21.3 | wxWidgets-3.2.4
Post Reply