Undefined reference using Noesis with CMake
Hi!
I am currently working on a Noesis integration in c++, and am having troubles linking to the library. I am using the IDE CLion together with CMake, and there seems to be a big lack of resources to find out how to do that with Noesis. I have successfully added the header files, and have managed to get cmake to find the .lib files, but that's where I run into problems. It seems like no matter what I try to do with the .dll files, they are not located by Cmake, and I am having undefined reference errors everywhere. It says in the integration tutorial that "/Bin: this is the directory where dynamic libraries, one folder per architecture, can be found. Your executable must be able to reach this path. The easiest way is by copying it here in a post-build step." but this doesn't seem to work at all?
I have tried to put the .dll files into the cmake-build-debug folder, and I've tried putting them in the cmake-build-debug/bin folder, but it doesn't help. I am also linking to the .dll files using target-link-libraries, but that doesn't seem to help the process either. It's a shame that there doesn't seem to be much official support for CMake, and I would love to see you add an example CMakeList.txt alongside where to put the library files, but right now I just want this to work to be honest.
I am currently working on a Noesis integration in c++, and am having troubles linking to the library. I am using the IDE CLion together with CMake, and there seems to be a big lack of resources to find out how to do that with Noesis. I have successfully added the header files, and have managed to get cmake to find the .lib files, but that's where I run into problems. It seems like no matter what I try to do with the .dll files, they are not located by Cmake, and I am having undefined reference errors everywhere. It says in the integration tutorial that "/Bin: this is the directory where dynamic libraries, one folder per architecture, can be found. Your executable must be able to reach this path. The easiest way is by copying it here in a post-build step." but this doesn't seem to work at all?
I have tried to put the .dll files into the cmake-build-debug folder, and I've tried putting them in the cmake-build-debug/bin folder, but it doesn't help. I am also linking to the .dll files using target-link-libraries, but that doesn't seem to help the process either. It's a shame that there doesn't seem to be much official support for CMake, and I would love to see you add an example CMakeList.txt alongside where to put the library files, but right now I just want this to work to be honest.
Re: Undefined reference using Noesis with CMake
Have you checked out the project setups for Visual Studio, XCode, and Makefile that are available in our SDKs? You should be able to translate that configuration to CMake. Unfortunately, I’m not very familiar with CMake myself, but that should give you a good starting point.
Re: Undefined reference using Noesis with CMake
I'm looking through them, but I don't think they are similar enough to translate enough for my problem specifically. Just to narrow it down a bit for me though, should the .dll files be in the same folder as the executable, or should the bin/ folder in the sdk be moved to where the executable is? Rn I have separated the parts a bit, where the dll files are together with the executable, the .lib files are in a subfolder of the Noesis headers inside my own lib directory. Afaik it is the lib files that give instructions for the program to locate the .dll files, and as such it would be helpful how I should think around that. I don't feel like I am sufficiently knowledgeable about the other forms of make files to detect where the .dll files are pointed to for example, or where they should be located in the project.
Re: Undefined reference using Noesis with CMake
In our projects, all binaries (including dynamic libraries and executables) go into the same folder. This is the simplest setupabout the other forms of make files to detect where the .dll files are pointed to for example, or where they should be located in the project.
Re: Undefined reference using Noesis with CMake
Update:
I got it working, I had to switch to MSVC from MingW/GCC. I'll also post my CMakeList.txt contents here just in case anyone will have the same problem in the future:
I also had to place Noesis.dll inside of the build folder, in cmake-build-debug/Debug which is where MSVC creates the executable.
I got it working, I had to switch to MSVC from MingW/GCC. I'll also post my CMakeList.txt contents here just in case anyone will have the same problem in the future:
Code: Select all
cmake_minimum_required(VERSION 3.29)
project(untitled)
set(CMAKE_CXX_STANDARD 23)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/libs/Noesis")
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/libs/Noesis/Bin/windows_x86_64")
add_library(noesis SHARED IMPORTED)
set_target_properties(noesis PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/libs/Noesis"
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libs/Noesis/Bin/windows_x86_64/Noesis.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/libs/Noesis/Lib/windows_x86_64/Noesis.lib"
)
add_executable(untitled main.cpp)
target_link_libraries (untitled noesis)
Re: Undefined reference using Noesis with CMake
Thank you for getting back with a solution!
Who is online
Users browsing this forum: Bing [Bot] and 4 guests