Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake link error #197

Open
yourbikun opened this issue Nov 29, 2024 · 2 comments
Open

cmake link error #197

yourbikun opened this issue Nov 29, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@yourbikun
Copy link

I am using lunasvg to process svg images for my project. I compile it with cmake.
When I use FetchContent given in the Readme to include, the project compiles normally. When I pre-compile lunasvg, I get two folders, include and lib. And link it to my project, but "error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall lunasvg::Bitmap::~Bitmap(void)"" appears

Can you give me some advice on how to link lunasvg with cmake? I don't know much about this.
This is my cmake link command:
include_directories(${CMAKE_CURRENT_LIST_DIR}/include/lunasvg)
include_directories(${CMAKE_CURRENT_LIST_DIR}/include/plutovg)
set(lunasvg_lib_DIR ${CMAKE_CURRENT_LIST_DIR}/lib)
link_directories(${lunasvg_lib_DIR})

By the way, I compiled lunasvg in Release form on Windows, like this:
git clone https://github.com/sammycage/lunasvg.git
cd lunasvg
cmake -B build -DCMAKE_INSTALL_PREFIX="C:/Users/ins/Desktop/oto/plutosvg/install" -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR_TOOLSET=v142 -A Win32 -DCMAKE_SYSTEM_VERSION=8.1 cmake --build build --config Release cmake --install build

I found that the lib folder only has .lib files but no .dll files. Is this the reason?

@sammycage sammycage added duplicate This issue or pull request already exists question Further information is requested labels Nov 29, 2024
@sammycage
Copy link
Owner

Since you are building a static library on Windows, define LUNASVG_BUILD_STATIC before importing the library.

#185 (comment)

@yourbikun
Copy link
Author

Since you are building a static library on Windows, define LUNASVG_BUILD_STATIC before importing the library.

#185 (comment)

Thanks for your reply, I will try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants