Skip to content

Linker cannot find the external symbols #797

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
Joel-N99 opened this issue Apr 14, 2025 · 1 comment
Open

Linker cannot find the external symbols #797

Joel-N99 opened this issue Apr 14, 2025 · 1 comment

Comments

@Joel-N99
Copy link

As the title says, the msvc linker cannot find a long list of symbols despite the library being used.

This is one of the errors:

unresolved external symbol __imp_accept referenced in function "bool __cdecl Superpowered::netAccept(int,int *,void *)" (?netAccept@Superpowered@@YA_NHPEAHPEAX@Z)

The right library, SuperpoweredWin143_Debug_MD_x64.lib , is being used as shown by the "file" column.
Apology in advance if this is a stupid mistake on my part but I can't find anything about this on the internet.
The following is the cmakelists content:

# CMakeList.txt : CMake project for console_test, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

# Enable Hot Reload for MSVC compilers if supported.
if (POLICY CMP0141)
  cmake_policy(SET CMP0141 NEW)
  set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()

project ("console_test")

# Add source to this project's executable.
add_executable (console_test "console_test.cpp" "console_test.h" "include/Superpowered.h" "include/Superpowered3BandEQ.h" "include/SuperpoweredAdvancedAudioPlayer.h" "include/SuperpoweredAEC.h" "include/SuperpoweredAES.h" "include/SuperpoweredAnalyzer.h" "include/SuperpoweredAndroidUSB.h" "include/SuperpoweredAudioBuffers.h" "include/SuperpoweredAutomaticVocalPitchCorrection.h" "include/SuperpoweredBandpassFilterbank.h" "include/SuperpoweredBitcrusher.h" "include/SuperpoweredClipper.h" "include/SuperpoweredCompressor.h" "include/SuperpoweredCPU.h" "include/SuperpoweredDecoder.h" "include/SuperpoweredDelay.h" "include/SuperpoweredEcho.h" "include/SuperpoweredFFT.h" "include/SuperpoweredFilter.h" "include/SuperpoweredFlanger.h" "include/SuperpoweredFrequencyDomain.h" "include/SuperpoweredFX.h" "include/SuperpoweredGate.h" "include/SuperpoweredGenerator.h" "include/SuperpoweredGuitarDistortion.h" "include/SuperpoweredHash.h" "include/SuperpoweredHTTP.h" "include/SuperpoweredJSON.h" "include/SuperpoweredLimiter.h" "include/SuperpoweredMixer.h" "include/SuperpoweredRecorder.h" "include/SuperpoweredResampler.h" "include/SuperpoweredReverb.h" "include/SuperpoweredRoll.h" "include/SuperpoweredRSA.h" "include/SuperpoweredSimple.h" "include/SuperpoweredSpatializer.h" "include/SuperpoweredTimeStretching.h" "include/SuperpoweredWhoosh.h")
set(CMAKE_EXE_LINKER_FLAGS "/libpath:libWindows\\")

if (CMAKE_VERSION VERSION_GREATER 3.12)
  set_property(TARGET console_test PROPERTY CXX_STANDARD 20)
endif()

# TODO: Add tests and install targets if needed.

System:

  • Windows 11
  • Visual Studio 2022
  • build tool: Cmake
@ivannador
Copy link
Contributor

Hey @Joel-N99

This happens because a CMake project won't automatically link Winsock, which is used by Superpowered. With Visual Studio this is linked implicitly.

Link the Ws2_32.lib library in CMake by adding the following line somewhere after add_executable:

target_link_libraries(console_test PRIVATE Ws2_32.lib)

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

2 participants