wx version 3.3 (build from 8/2/2023)
Visual Studio 2022
Windows 11
This is similar to issue #23643, but on Windows.
FIND_PACKAGE
and include "stc" like this:FIND_PACKAGE(wxWidgets REQUIRED core base adv html ribbon xml xrc qa propgrid scintilla stc aui net)
I get link errors:
Error LNK2019 unresolved external symbol CreateLexer referenced in function "public: virtual __int64 __cdecl ScintillaWX::WndProc(unsigned int,unsigned __int64,__int64)" (?WndProc@ScintillaWX@@UEAA_JI_K_J@Z)
Error LNK2019 unresolved external symbol LexerNameFromID referenced in function "public: virtual __int64 __cdecl ScintillaWX::WndProc(unsigned int,unsigned __int64,__int64)" (?WndProc@ScintillaWX@@UEAA_JI_K_J@Z)
Error LNK2019 unresolved external symbol "bool __cdecl Lexilla::Load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?Load@Lexilla@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: virtual __int64 __cdecl ScintillaWX::WndProc(unsigned int,unsigned __int64,__int64)" (?WndProc@ScintillaWX@@UEAA_JI_K_J@Z)
I had added "scintilla" which fixed a number of other link errors, but now the ones above remain. Adding "lexilla" isn't recognized, so maybe something in wx's cmake system needs to recognize "lexilla". I'm not sure how that works.
I can work around it by doing this:
target_link_libraries(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../wxWidgets/lib/vc_x64_lib/wxlexillad.lib)
But I'm thinking I should be able to just pass "stc" (and maybe "lexilla") to FIND_PACKAGE
to get this to work. Thanks.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Seems like an issue on the CMake side (FindwxWidgets module)?
I am not sure if it is still applies after using the new(er) scintilla where the libraries were split, but it may be (similar to) this: https://gitlab.kitware.com/cmake/cmake/-/issues/23519
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
This could indeed be a FindwxWidgets
issue, since it hasn't been updated for lexilla
.
But wxWidgets provides its own wxWidgetsConfig
since 3.2, bypassing FindwxWidgets
. Just specify the CONFIG
parameter:
find_package(wxWidgets CONFIG)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
This could indeed be a
FindwxWidgets
issue, since it hasn't been updated forlexilla
.But wxWidgets provides its own
wxWidgetsConfig
since 3.2, bypassingFindwxWidgets
. Just specify theCONFIG
parameter:
find_package(wxWidgets CONFIG)
Should that work on MSW? Trying that gives me this error in MSVC:
Error CMake Error at ...\CMakeLists.txt:71 (INCLUDE):
INCLUDE called with wrong number of arguments. include() only takes one
file.
Please note that I was calling this before:
FIND_PACKAGE(wxWidgets REQUIRED core base adv html ribbon xml xrc qa propgrid scintilla stc aui net)
not FindwxWidgets
. Also, if I don't pass "scintilla " as one of the components, I get many more link issues; adding that fixed numerous Scintilla link issues.
Also, my CMake finds wx by me explicitly setting wxWidgets_ROOT_DIR
, I assume that's all you can do on MSW.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
FIND_PACKAGE(wxWidgets)
uses FindwxWidgets cmake module, thats why we refer to it as FindwxWidgets
.
You probably use include(${wxWidgets_USE_FILE})
. This isn't defined when using CONFIG
mode. Just
target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
is enough.
You can still use REQUIRED
and specify the components you want. Though specifying scintilla
does not work, since it is not an official component. Only stc
is needed.
I think setting wxWidgets_ROOT_DIR
should still work. If not, CMake gives you a hint that you can specify wxWidgets_DIR
and point it to the config files (<installdir>/lib/cmake/wxWidgets
).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I removed include(${wxWidgets_USE_FILE})
and tried find_package(wxWidgets CONFIG)
, but that causes all my files referencing wx files to not be able to find them. I then explicitly point target_include_directories
to include the wx "include" folder and that fixes those errors, but now I get this from wx's code base:
Error C1083 Cannot open include file: 'wx/setup.h': No such file or directory C:\Users\source\wxWidgets\include\wx\platform.h 159
I think you really must use include(${wxWidgets_USE_FILE})
on MSW, I can't work around not using it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
It should not be needed. You can check out the minimum sample, it does the same.
When you use target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
, it links with wx targets (like wx::base
) which contain the include directories, defines, and libraries needed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
OK, after following the new sample and doing this:
FIND_PACKAGE(wxWidgets 3.3 COMPONENTS core base REQUIRED CONFIG)
wxWidgets_ROOT_DIR
no longer works and you must use wxWidgets_DIR
and set it to the location of where either "wxWidgetsConfig.cmake" or "wxWidgets-Config.cmake" are. I can't find these files. I found "wxWidgetsConfig.cmake.in" and renamed it, but then I get this error:
`Error CMake Error at C:\Users\CMakeLists.txt:69 (FIND_PACKAGE):
Could not find a configuration file for package "wxWidgets" that is
compatible with requested version "3.3".
The following configuration files were considered but not accepted:
C:/Users/source/wxWidgets/build/cmake/wxWidgetsConfig.cmake, version: unknown ...\CMakeLists.txt`
I tried opening the sample and I'm getting these same errors. I'm not sure what to set wxWidgets_DIR
to or where these files are supposed to be at on MSW.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Those are installed when you build and install wxWidgets using CMake. I'm afraid they are not included in the provided binaries or when you build wxWidgets using a different method.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
That did it, thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #23749 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.