CMake cannot find SFML

Started by luka, 26 March 2024, 06:27:21

luka

Hello, I'm currently trying to integrate TGUI into my SFML project. I'm using CMake and VS Code, but I've encountered a problem where TGUI can't find SFML. I have the error message ready here, which mentions setting the SFML_DIR, but I'm not sure exactly where to do that. Any help would be greatly appreciated.

[main] Building folder: AutoBackupScript2
[main] Configuring project: AutoBackupScript2
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SC:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/TGUI -Bc:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build -G "MinGW Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake]
[cmake] Searching for SFML 2...
[cmake]
[cmake] -- Could NOT find SFML (missing: SFML_DIR)
[cmake]
[cmake] Searching for SFML 3...
[cmake]
[cmake] -- Could NOT find SFML (missing: SFML_DIR)
[cmake] CMake Error at cmake/Dependencies.cmake:80 (message):
[cmake]  CMake couldn't find SFML.
[cmake]
[cmake]  Set SFML_DIR to the directory containing SFMLConfig.cmake (usually
[cmake]  something like SFML_ROOT/lib/cmake/SFML)
[cmake]
[cmake] Call Stack (most recent call first):
[cmake]  cmake/Dependencies.cmake:93 (tgui_find_dependency_sfml)
[cmake]  src/Backend/CMakeLists.txt:153 (tgui_add_dependency_sfml)
[cmake]  src/CMakeLists.txt:305 (include)
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SC:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/TGUI -Bc:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build -G "MinGW Makefiles" exited with code: 1


I have integrated TGUI into my project as follows:

Project/
├── CMakeLists.txt (Main project)
├── src/
│  └── main.cpp
└── TGUI/

and SFML is not directly in the project folder, but it usually finds it after setting the SFML_DIR.

My CMakeLists.txt from the main project:

cmake_minimum_required(VERSION 3.17)
project(AutoBackupScript VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)

# Füge die Quelldateien hinzu
set(SOURCES
    src/main.cpp

)

include_directories(headers)

# Füge das ausführbare Ziel hinzu und verlinke ImGui
add_executable(AutoBackupScript ${SOURCES})

#target_link_libraries(AutoBackupScript PRIVATE TGUI)

# Suche und verlinke SFML
set(SFML_DIR "c:/SFML/lib/cmake/SFML")  # Pfad zum SFML CMake-Modul
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
if (SFML_FOUND)
    target_link_libraries(AutoBackupScript PRIVATE sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
endif()

#target_link_libraries(AutoBackupScript PRIVATE TGUI)

set(SFML_DIR "c:/SFML/lib/cmake/SFML")
#include_directories(${CMAKE_SOURCE_DIR}/TGUI)
#include_directories(${CMAKE_SOURCE_DIR})
#add_subdirectory(TGUI)

#find_package(TGUI 1 REQUIRED)
#target_link_libraries(AutoBackupScript PRIVATE TGUI::TGUI)

# Kopiere DLLs in das Build-Verzeichnis
if(WIN32)
    file(GLOB BINARY_DEP_DLLS "c:/SFML/bin/*.dll")
    file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
    file(GLOB MINGW_DEP_DLLS "C:/mingw64/bin/*.dll")
    file(COPY ${MINGW_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif()


texus

The set(SFML_DIR "c:/SFML/lib/cmake/SFML") should be sufficient when placed before the find_package or add_subdirectory line.

TGUI tries to find SFML with "find_package(SFML 2 CONFIG COMPONENTS graphics REQUIRED)".

- Which files does c:/SFML/lib/cmake/SFML contain?
- Which SFML version is located in c:/SFML?
- Did you build SFML yourself or download a precompiled version from their website?
- Which MinGW version are you using?

luka

Quote from: texus on 26 March 2024, 08:40:15The set(SFML_DIR "c:/SFML/lib/cmake/SFML") should be sufficient when placed before the find_package or add_subdirectory line.

TGUI tries to find SFML with "find_package(SFML 2 CONFIG COMPONENTS graphics REQUIRED)".

- Which files does c:/SFML/lib/cmake/SFML contain?
- Which SFML version is located in c:/SFML?
- Did you build SFML yourself or download a precompiled version from their website?
- Which MinGW version are you using?

Thank you for the prompt response and assistance.

1. alle the cmake files
   - SFMLConfig.cmake
   - SFMLConfigDependencies.cmake
   - SFMLConfigVersion.cmake
   - SFMLSharedTargets.cmake
   - SFMLSharedTargets-debug.cmake
   - SFMLSharedTargets-release.cmake
   - SFMLStaticTargets.cmake
   - SFMLStaticTargets-debug.cmake
   - SFMLStaticTargets-release.cmake
2. SFML 2.6.0 is installed
3. I downloaded a precompiled version from their website.
4. I am using GCC 13.1.0 MinGW 64-bit

texus

#3
I'm a bit confused about how the project is being build.

The log contained the following line:
Quote[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SC:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/TGUI -Bc:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build -G "MinGW Makefiles"

The source directory is being set to the "TGUI" subdirectory, but the build directory is the one from your project? That would mean that it is trying to build TGUI and your own cmake script isn't even being executed.

If that command where to contain "-DSFML_DIR=c:/SFML/lib/cmake/SFML" then it would probably build TGUI successfully. However that would only build TGUI and not your project, so you probably want to change the source directory instead.

luka

#4
I apologize for any confusion. I am new to CMake, so my knowledge is somewhat limited. I have only used CMake for incorporating SFML into two projects, and you can see how I did that in my CMakeLists.txt files, which compile without any issues. I referred to this blog post (https://www.ics.com/blog/find-and-link-libraries-cmake) to integrate the TGUI library, so I'm having a bit of trouble following your steps.

QuoteThe source directory is being set to the "TGUI" subdirectory, but the build directory is the one from your project? That would mean that it is trying to build TGUI and your own cmake script isn't even being executed.

I tried something different. Here is the orignale Cmakelists.txt:
cmake_minimum_required(VERSION 3.17)
project(AutoBackupScript VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)

include_directories(headers)
add_subdirectory(TGUI)

# Füge die Quelldateien hinzu
set(SOURCES
    src/main.cpp

)


# Füge das ausführbare Ziel hinzu und verlinke ImGui
add_executable(AutoBackupScript ${SOURCES})

set(TGUI_DIR "C:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/TGUI/cmake")
find_package(TGUI 1 REQUIRED)

target_link_libraries(AutoBackupScript PRIVATE TGUI)

# Suche und verlinke SFML
set(SFML_DIR "c:/SFML/lib/cmake/SFML")  # Pfad zum SFML CMake-Modul
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
if (SFML_FOUND)
    target_link_libraries(AutoBackupScript PRIVATE sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
endif()

# Kopiere DLLs in das Build-Verzeichnis
if(WIN32)
    file(GLOB BINARY_DEP_DLLS "c:/SFML/bin/*.dll")
    file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
    file(GLOB MINGW_DEP_DLLS "C:/mingw64/bin/*.dll")
    file(COPY ${MINGW_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif()


but i encountered a similar problem.
[main] Building folder: AutoBackupScript2
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 --
[build]
[build] Searching for SFML 2...
[build]
[build] -- Could NOT find SFML (missing: SFML_DIR)
[build]
[build] Searching for SFML 3...
[build]
[build] -- Could NOT find SFML (missing: SFML_DIR)
[build] CMake Error at TGUI/cmake/Dependencies.cmake:80 (message):
[build]   CMake couldn't find SFML.
[build]
[build]   Set SFML_DIR to the directory containing SFMLConfig.cmake (usually
[build]   something like SFML_ROOT/lib/cmake/SFML)
[build]
[build] Call Stack (most recent call first):
[build]   TGUI/cmake/Dependencies.cmake:93 (tgui_find_dependency_sfml)
[build]   TGUI/src/Backend/CMakeLists.txt:153 (tgui_add_dependency_sfml)
[build]   TGUI/src/CMakeLists.txt:305 (include)
[build]
[build]
[build] -- Configuring incomplete, errors occurred!
[build] mingw32-make: *** [Makefile:178: cmake_check_build_system] Error 1
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 -- exited with code: 2
[driver] Build completed: 00:00:00.482
[build] Build finished with exit code 2


Thank you for your time and assistance.

texus

Now the log output looks more normal.
You need to move the set(SFML_DIR "c:/SFML/lib/cmake/SFML") line in your script to ABOVE the "add_subdirectory(TGUI)" line.

Also, your code should either contain "add_subdirectory(TGUI)" or "set(TGUI_DIR ...)\n find_package(TGUI 1 REQUIRED)", but not both of these.

luka

I deeply appreciate your assistance thus far. Nevertheless, I've encountered a snag with the GUI builder.

[main] Building folder: AutoBackupScript2
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 --
[build] [  3%] Linking CXX executable AutoBackupScript.exe
[build] [ 81%] Built target tgui
[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lTGUI: No such file or directory
[build] collect2.exe: error: ld returned 1 exit status
[build] mingw32-make[2]: *** [CMakeFiles\AutoBackupScript.dir\build.make:104: AutoBackupScript.exe] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:132: CMakeFiles/AutoBackupScript.dir/all] Error 2
[build] mingw32-make[1]: *** Waiting for unfinished jobs....
[build] [ 96%] Built target gui-builder
[build] mingw32-make: *** [Makefile:135: all] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 -- exited with code: 2
[driver] Build completed: 00:00:00.913
[build] Build finished with exit code 2


texus

The error isn't with the gui builder. If you set TGUI_BUILD_GUI_BUILDER to OFF then you would get the same error.

The library name passed to "target_link_libraries" should be either "TGUI::TGUI" (recommended) or "tgui" (deprecated), but "TGUI" is wrong.

The cmake command that is being executed has "-j 6" in it. Is this something you can change yourself? The log output would have been more clear if you ran it with "-j 1" (which you should only do when investigating an issue, as usually you do want to build with more threads). Now it builds your project and the gui builder at the same time so it prints both outputs interleaved and it isn't clear that the error is about your project and not the gui builder.

luka

Quote from: texus on 27 March 2024, 19:28:51The library name passed to "target_link_libraries" should be either "TGUI::TGUI" (recommended)

I've managed to compile this file now.
#include <TGUI/TGUI.hpp>
#include <TGUI/Backend/SFML-Graphics.hpp>


int main()
{

}

I now have an issue with the example for the SFML backend, encountering an undefined reference to the bool runExample(tgui::BackendGui& gui) function.

[main] Building folder: AutoBackupScript2
[build] Starting build
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 --
[build] [ 77%] Built target tgui
[build] [ 81%] Building CXX object CMakeFiles/AutoBackupScript.dir/src/main.cpp.obj
[build] [ 96%] Built target gui-builder
[build] [100%] Linking CXX executable AutoBackupScript.exe
[build] C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles\AutoBackupScript.dir/objects.a(main.cpp.obj): in function `main':
[build] C:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/src/main.cpp:41: undefined reference to `runExample(tgui::BackendGui&)'
[build] collect2.exe: error: ld returned 1 exit status
[build] mingw32-make[2]: *** [CMakeFiles\AutoBackupScript.dir\build.make:108: AutoBackupScript.exe] Error 1
[build] mingw32-make[1]: *** [CMakeFiles\Makefile2:132: CMakeFiles/AutoBackupScript.dir/all] Error 2
[build] mingw32-make: *** [Makefile:135: all] Error 2
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --build c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build --config Debug --target all -j 6 -- exited with code: 2
[driver] Build completed: 00:00:05.274
[build] Build finished with exit code 2

Quote from: texus on 27 March 2024, 19:28:51The cmake command that is being executed has "-j 6" in it. Is this something you can change yourself? The log output would have been more clear if you ran it with "-j 1" (which you should only do when investigating an issue, as usually you do want to build with more threads). Now it builds your project and the gui builder at the same time so it prints both outputs interleaved and it isn't clear that the error is about your project and not the gui builder.

There is a way, is that something I should consider in general or is it more something for debugging?

texus

QuoteI now have an issue with the example for the SFML backend, encountering an undefined reference to the bool runExample(tgui::BackendGui& gui) function.

The TGUI examples found in the "examples" folder are split into 2 parts. The first part contains just the main() function and shows how to initialize the window and gui (using backend-specific code, in this case using SFML Graphics). The second part is the "runExample" function that contains the code that is backend-independent and which is thus the same no matter whether you are using SFML, SDL or GLFW. The second part is found inside either the "scalable_login_screen" or "many_different_widgets" subfolder.

I'm guessing you only have a declaration like "bool runExample(tgui::BackendGui& gui);" in your current code. You can replace it with the following to have an example that compiles:
Code (cpp) Select
bool runExample(tgui::BackendGui& gui)
{
    return true;
}

The website contains some more example codes: https://tgui.eu/examples/latest-stable/

texus

Quoteis that something I should consider in general or is it more something for debugging?

It's only for debugging.
The higher the number, the faster the project will build (as the number indicates how many source files can be compiled simultaneously). At least as long as the number doesn't exceed the amount of CPU threads your processor has (a higher number will work but won't make it faster) and as long as you have sufficient RAM (which becomes important for very high values).
Setting it to 1 means that all operations are done sequentially and nothing is done in parallel. This makes building much slower, but then the logs will properly show you which step is being executed when the error happens.

luka

#11
Quote from: texus on 27 March 2024, 22:45:23
Quoteis that something I should consider in general or is it more something for debugging?

It's only for debugging.
The higher the number, the faster the project will build (as the number indicates how many source files can be compiled simultaneously). At least as long as the number doesn't exceed the amount of CPU threads your processor has (a higher number will work but won't make it faster) and as long as you have sufficient RAM (which becomes important for very high values).
Setting it to 1 means that all operations are done sequentially and nothing is done in parallel. This makes building much slower, but then the logs will properly show you which step is being executed when the error happens.

Good to know. I believe I'll need to delve deeper into CMake to fully utilize it. Thank you very much for your patience and guidance. Everything is functioning now.

luka

Apologies for bothering you once more. Despite the initial joy of successfully compiling the program, it appears to crash every time I attempt to run it, without any error messages. Could I be overlooking something, such as copying .dll files or a similar requirement?

texus

QuoteCould I be overlooking something, such as copying .dll files or a similar requirement?
It's possible, but it's hard to say if you don't actually get an error message. Are the sfml and dll files placed next to the exe?

I don't really know VS Code. Do you have some process output somewhere? If the program crashes then it usually sets a return value other than 0. If you find some output with something similar to "program exited with code ..." then you can usually search online for that code to determine whether it ended due to a missing dll, an access violation or an uncaught exception.

There are 2 things you can test:
1) Run the exe from file explorer instead of from the IDE. If it won't run due to a missing dll, you will get an error when attempting to run the exe like that.
2) If something goes wrong in TGUI (e.g. a file can't be loaded), then it will throw an exception. If you don't catch this exception then the program terminates.

Do something like this in the main function to print something to the command line when an exception occurs, so that you can see what went wrong. I'm not sure if you will be able to see the text printed somewhere, but you might also be able to e.g. put a breakpoint in the catch code to test if it passes there. The "e.what()" value is a string that contains the TGUI error message.
Code (cpp) Select
int main()
{
    try
    {
        // <Put your existing code here>
        return 0;
    }
    catch (const tgui::Exception& e)
    {
        std::cerr << "TGUI exception: " << e.what() << std::endl;
        return 1;
    }
}

luka

Quote from: texus on 28 March 2024, 08:39:33It's possible, but it's hard to say if you don't actually get an error message. Are the sfml and dll files placed next to the exe?

The SFML .dll files are present, but when attempting to run the .exe directly from the build directory, I receive an error stating that the tgui-d.dll is not found. Where can I find it?

texus

Somewhere inside your "c:/Users/luka-/OneDrive/Desktop/AutoBackupScript2/build" folder. Probably inside the "TGUI/lib/Debug" subdirectory.

There is a way to let CMake automatically copy the dll when building. Try adding the following to your cmake script: (I didn't test this so it might not work as-is)
Code (cmake) Select
add_custom_command(
    TARGET AutoBackupScript POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:tgui>" "."
    VERBATIM)

luka

#16
The command copied or created the .dll, but the application still crashes. When attempting to start the .exe in the build directory, I now receive an error stating that the file doesn't exist or is not suitable for Windows. Error code: 0xc000012f

In VS Code, the application crashes with the error "Command executed, took 85ms and failed (Exit code 1).

texus

0xc000012f seems to mean that the "Microsoft Visual C++ Redistributable" isn't installed, which is a bit weird in this case. To run any software that was build with Visual Studio, you need to have the redistributable installed for that Visual Studio version. It raises a question though: what code is built with Visual C++? You are building with MinGW, the precompiled SFML libraries were build with MinGW, and TGUI is being build together with your project and also with the MinGW compiler.

Is the bin directory of your MinGW compiler in your PATH environment variable?
Just to be safe, can you copy libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll from "C:\mingw64\bin\" and place them next to your exe?

luka

#18
Quote0xc000012f seems to mean that the "Microsoft Visual C++ Redistributable" isn't installed, which is a bit weird in this case. To run any software that was build with Visual Studio, you need to have the redistributable installed for that Visual Studio version. It raises a question though: what code is built with Visual C++? You are building with MinGW, the precompiled SFML libraries were build with MinGW, and TGUI is being build together with your project and also with the MinGW compiler.
It seems like it, but that is super confusing.

They are already in there. My CMake script copies all SFML and MinGW .dll files into the build directory while configuring the project.

texus

I'm not sure how much I can help with this issue.

One thing you could still try is to use the precompiled TGUI libraries for MinGW 64bit instead of building them yourself, although I doubt that it will solve anything.

Have you tried reinstalling the latest Microsoft Visual C++ Redistributable version just to be sure?

Could you create a zip file with the exe, SFML dlls, TGUI dll and the 3 gcc dlls that I mentioned in my previous post and send those to me? Then I can try testing if I find anything weird with it.
Could you also post the current CMake script that you are using? Maybe I can try building the same way here and see if I can reproduce it or not.

luka

Thank you. I tried reinstalling it, and here's the zip archive. I included the entire build directory to ensure you have everything. The 'CMakeLists.txt' is provided below.


https://www.file2send.eu/de/download/GEhzYpN1BJhd2Y1m0MgbUMYLQyCJkkVeKlb6AedpqskgnzPtTUlKRuBdINyfGF1J

cmake_minimum_required(VERSION 3.17)
project(AutoBackupScript VERSION 0.1.0 LANGUAGES C CXX)

set(CMAKE_CXX_STANDARD 20)

include_directories(headers)
set(SFML_DIR "c:/SFML/lib/cmake/SFML")  # Pfad zum SFML CMake-Modul
add_subdirectory(TGUI)

# list of source files
set(SOURCES
    #src/main.cpp
    src/ScalableLoginScreen.cpp
)


# add executable
add_executable(AutoBackupScript ${SOURCES})


target_link_libraries(AutoBackupScript PRIVATE TGUI::TGUI)

# searching and linking sfml
find_package(SFML COMPONENTS system window graphics network audio REQUIRED)
if (SFML_FOUND)
    target_link_libraries(AutoBackupScript PRIVATE sfml-system sfml-window sfml-graphics sfml-network sfml-audio)
endif()

add_custom_command(
    TARGET AutoBackupScript POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:tgui>" "."
    VERBATIM)

# copying the Dll files in the build directory
if(WIN32)
    file(GLOB BINARY_DEP_DLLS "c:/SFML/bin/*.dll")
    file(COPY ${BINARY_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
    file(GLOB MINGW_DEP_DLLS "C:/mingw64/bin/*.dll")
    file(COPY ${MINGW_DEP_DLLS} DESTINATION ${CMAKE_BINARY_DIR})
endif()


texus

#21
I have no idea how it's even possible, but something looks wrong with that TGUI dll. The size of your dll is smaller than the ones I have. Even the 32bit dlls that I have are still larger than the tgui-d.dll that was generated on your pc.

I've downloaded the "MinGW-w64 13.1.0 - x86_64‑posix‑seh (64bit)" version of TGUI 1.2.0 from https://tgui.eu/download/ and copied the tgui-d.dll from the bin folder of the zip file into your build_directory and afterwards I could run your exe just fine (after also copying xubuntu_bg_aluminium.jpg into the build_directory).

EDIT: Your dll file isn't even recognized as a valid DLL by the tools that I have to dump dll information.
EDIT 2: The first 1536 bytes (= exactly 3 * 512 bytes) in your DLL are all 0-bytes, so the file looks corrupted. Have you tried deleting the file and letting your cmake project generate it again?

luka

#22
QuoteEDIT: Your dll file isn't even recognized as a valid DLL by the tools that I have to dump dll information.
EDIT 2: The first 1536 bytes (= exactly 3 * 512 bytes) in your DLL are all 0-bytes, so the file looks corrupted. Have you tried deleting the file and letting your cmake project generate it again?

I tried deleting it and copying it with the CMake script, but I still encountered the same error. So, I attempted to locate the file where it's being copied from, but I couldn't find anything. Is it possible that the file is not in the folder and CMake creates it?

Copying the tgui-d.dll from TGUI 1.2.0 works in VS Code and directly from the directory. Thank you very much.

texus

Quotebut I couldn't find anything. Is it possible that the file is not in the folder and CMake creates it?
The file has to be created by CMake somewhere in your build directory. Deleting the entire build directory should cause it to be recreated from scratch instead of from cached files.

The most important thing is that you got it working now though.