You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: I can't compile my program when I set both SFML and TGUI to use static libraries. The program compiles and executes succesfully when linked with dynamic libraries. I'd prefer static ones though since one has to copy all DLLs into their build folder and
System: Windows 10 Compiler: MSVC 17.9.2 (toolset v143) CMake: 3.26.1
CMakeLists.txt:
cmake_minimum_required ( VERSION 3.26 )
project ( Repro )
set ( SFML_VERSION "3.0.0" )
set ( TGUI_VERSION "1.7.0")
include ( FetchContent )
FetchContent_Declare ( SFML
URL "https://github.com/SFML/SFML/releases/download/${SFML_VERSION}/SFML-${SFML_VERSION}-windows-vc17-64-bit.zip"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_SUBDIR "does-not-exist" # Prevents MakeAvailable from calling add_subdirectory
)
FetchContent_Declare ( TGUI
URL "https://github.com/texus/TGUI/releases/download/v${TGUI_VERSION}/TGUI-${TGUI_VERSION}-vc17-64bit-for-SFML-${SFML_VERSION}.zip"
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
SOURCE_SUBDIR "does-not-exist" # Prevents MakeAvailable from calling add_subdirectory
)
FetchContent_MakeAvailable( SFML TGUI )
set ( SFML_STATIC_LIBRARIES ON )
find_package ( SFML
${SFML_VERSION} REQUIRED
COMPONENTS Main Window Graphics
PATHS "${sfml_SOURCE_DIR}/lib/cmake"
)
set ( TGUI_BACKEND SFML_GRAPHICS )
set ( TGUI_STATIC_LIBRARIES ON )
find_package ( TGUI
${TGUI_VERSION} REQUIRED
PATHS "${tgui_SOURCE_DIR}/lib/cmake"
)
add_executable( ${PROJECT_NAME} Main.cpp )
target_link_libraries( ${PROJECT_NAME} PRIVATE SFML::Main SFML::System SFML::Window TGUI::TGUI )
Main.cpp:
#include <TGUI/Backend/SFML-Graphics.hpp>
#include <TGUI/Tgui.hpp>
#include <SFML/Window.hpp>
int main(int, char* [])
{
auto&& window = sf::RenderWindow(sf::VideoMode{ {1280, 720} }, "Repro", sf::State::Windowed);
auto&& gui = tgui::Gui(window);
while (window.isOpen())
{
while (const auto event = window.pollEvent())
{
if (event->is<sf::Event::Closed>()) window.close();
gui.handleEvent(*event);
}
window.clear();
gui.draw();
window.display();
}
}
Compiler diagnostic:
1>tgui-s-d.lib(unity_batch-4_cxx.obj) : error LNK2019: unresolved external symbol __std_min_element_f referenced in function "float const * __cdecl std::_Min_element_vectorized<float const >(float const * const,float const * const)" (??$_Min_element_vectorized@$$CBM@std@@YAPEBMQEBM0@Z)
1>tgui-s-d.lib(unity_batch-12_cxx.obj) : error LNK2001: unresolved external symbol __std_min_element_f
1>tgui-s-d.lib(unity_batch-4_cxx.obj) : error LNK2019: unresolved external symbol __std_max_element_f referenced in function "float const * __cdecl std::_Max_element_vectorized<float const >(float const * const,float const * const)" (??$_Max_element_vectorized@$$CBM@std@@YAPEBMQEBM0@Z)
1>C:\Users\jakub.neruda\Desktop\Repro\_build\Debug\Repro.exe : fatal error LNK1120: 2 unresolved externals
The text was updated successfully, but these errors were encountered:
Can you try updating your Visual Studio to the latest version (MSVC 17.13)?
It is possible that the TGUI libraries were built with a toolset newer than 17.9, which could cause errors like that.
Can you try updating your Visual Studio to the latest version (MSVC 17.13)? It is possible that the TGUI libraries were built with a toolset newer than 17.9, which could cause errors like that.
Good call. 17.12.2 on another computer works ok. And I naively thought that Microsoft maintains compatibility within a major version :/
Description: I can't compile my program when I set both SFML and TGUI to use static libraries. The program compiles and executes succesfully when linked with dynamic libraries. I'd prefer static ones though since one has to copy all DLLs into their build folder and
System: Windows 10
Compiler: MSVC 17.9.2 (toolset v143)
CMake: 3.26.1
CMakeLists.txt:
Main.cpp:
Compiler diagnostic:
The text was updated successfully, but these errors were encountered: