Skip to content

Conversation

Copy link

Copilot AI commented Sep 21, 2025

This PR fixes a Windows MSVC build failure where the linker could not resolve std::basic_ostream symbols when building BeamLatticeVoxelAcceleration_tests.cpp. The error manifested as:

BeamLatticeVoxelAcceleration_tests.cpp.obj : error LNK2019: unresolved external symbol "class std::basic_ostream

Root Cause

The issue was caused by conflicting linker subsystem flags in the Windows build. The build logs showed both /SUBSYSTEM:WINDOWS and /subsystem:console being applied simultaneously:

/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup /INCREMENTAL:NO /subsystem:console

This invalid configuration prevented proper iostream symbol linkage. The main CMakeLists.txt sets CMAKE_EXE_LINKER_FLAGS to include /SUBSYSTEM:WINDOWS globally, but test executables require console I/O for std::cout operations used extensively in the test suite.

Solution

Fixed subsystem conflict: Override the global Windows subsystem setting specifically for test executables:

set_target_properties(${BINARY} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE")

Explicit C++20 standard: Ensure unit tests match integration test configuration:

set_property(TARGET ${BINARY} PROPERTY CXX_STANDARD 20)
set_property(TARGET ${BINARY} PROPERTY CXX_STANDARD_REQUIRED ON)

Complete dependency chain: Added all required source files for the BeamLatticeVoxelAcceleration functionality:

  • BeamLatticeVoxelAcceleration.h/cpp - main voxel acceleration implementation
  • BeamLatticeVoxelAccelerationReference.h/cpp - reference implementation for testing
  • BeamLatticeResource.h/cpp and BeamBVH.h/cpp - required dependencies

The issue was specific to this test file because it combines complex template usage (measureExecutionTime<Func>), extensive iostream formatting operations, C++17 structured bindings, and heavy std::cout usage that triggered more template instantiations than simpler test files.

Fixes #8.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] 3dJan/prepare_1_2_14 fails to build on windows due to missing symbols Fix Windows MSVC iostream linking failure in BeamLatticeVoxelAcceleration tests Sep 21, 2025
Copilot AI requested a review from 3dJan September 21, 2025 18:59
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

Successfully merging this pull request may close these issues.

3dJan/prepare_1_2_14 fails to build on windows due to missing symbols

2 participants