Skip to content

Build Issue: Linker errors when building with shared library option #438

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

Open
TheGorge7 opened this issue Apr 9, 2025 · 0 comments
Open

Comments

@TheGorge7
Copy link

Environment

  • OS: Windows on ARM64
  • Compiler: Clang (LLVM)
  • Build System: CMake with Ninja
  • Repository: socket.io-client-cpp (latest version from main branch)

Steps to Reproduce:

  • Cloned the repository recursively:
git clone --recursive https://github.com/socketio/socket.io-client-cpp.git
cd socket.io-client-cpp
  • Generated build files with CMake:

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON
ninja

Error

The main library seems to build but when linking the test executable, I'm getting multiple "undefined symbol" errors for various methods in the sio::packet class:

[113/113] Linking CXX executable test\sio_test.exe
FAILED: test/sio_test.exe
C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -nostartfiles -nostdlib -O3 -DNDEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrt -Xlinker /subsystem:console -fuse-ld=lld-link test/CMakeFiles/sio_test.dir/sio_test.cpp.obj -o test\sio_test.exe -Xlinker /MANIFEST:EMBED -Xlinker /implib:test\sio_test.lib -Xlinker /pdb:test\sio_test.pdb -Xlinker /version:0.0   _deps/catch2-build/src/Catch2Main.lib  sioclient.lib  _deps/catch2-build/src/Catch2.lib  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -loldnames  && cd ."
lld-link: error: undefined symbol: public: __cdecl sio::packet::packet(class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char>> const &, class std::shared_ptr<class sio::message> const &, int, bool)
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_0(void))
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_12(void))

lld-link: error: undefined symbol: public: enum sio::packet::frame_type __cdecl sio::packet::get_frame(void) const
>>> referenced by test/CMakeFiles/sio_test.dir/sio_test.cpp.obj:(void __cdecl CATCH2_INTERNAL_TEST_0(void))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant