Skip to content

how to solve error LNK2005 occurs when linking ktx.dll #1266

Answered by xingfu2005
xingfu2005 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks your advice!
The problem has been solved. I modified vsgXchange\src\ktx\build_vars.cmake to use external ktx dependency build:

find_package(Ktx CONFIG REQUIRED)
if(Ktx_FOUND)
set(SOURCES ${SOURCES} ktx/ktx.cpp)
set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES} KTX::ktx)
set(EXTRA_DEFINES ${EXTRA_DEFINES} NEED_VK_GET_FORMAT_SIZE)
set(EXTRA_INCLUDES ${EXTRA_INCLUDES} $<BUILD_INTERFACE:${VSGXCHANGE_SOURCE_DIR}/src/ktx/lib>)
if(NOT BUILD_SHARED_LIBS)
set(FIND_DEPENDENCY ${FIND_DEPENDENCY} "find_dependency(Ktx)")
endif()
else()
# Compile ktx read library
set(KTX_SOURCES
ktx/libktx/ktx.h
# ktx/libktx/basis_sgd.h
ktx/libktx/checkheader.c
ktx/libktx/dfdutils/createdfd.c
# ktx/libktx/dfdutils/colou…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@xingfu2005
Comment options

Answer selected by xingfu2005
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants