Skip to content

Instantly share code, notes, and snippets.

@ObserverHerb
Created July 27, 2024 01:39
Show Gist options
  • Save ObserverHerb/9c3c52f9912ad8c6dce669cb25709feb to your computer and use it in GitHub Desktop.
Save ObserverHerb/9c3c52f9912ad8c6dce669cb25709feb to your computer and use it in GitHub Desktop.
(clang-19) declaration 'vtkNew' attached to named module can't be attached to other modules
cmake_minimum_required(VERSION 3.28)
project(vtk19 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(vtk19 main.cpp)
find_package(VTK REQUIRED COMPONENTS CommonCore CommonMath ViewsCore RenderingOpenGL2 FiltersTexture)
target_link_libraries(vtk19 PRIVATE
${VTK_LIBRARIES}
)
target_sources(vtk19 PUBLIC FILE_SET modules TYPE CXX_MODULES FILES
test.cpp
one.cpp
two.cpp
)
#include <iostream>
import Test;
int main()
{
Test();
return 0;
}
module;
#include <vtkCubeSource.h>
#include <vtkSmartPointer.h>
export module Test:One;
void TestOne()
{
vtkNew<vtkCubeSource> cube;
}
export module Test;
import :One;
import :Two;
export void Test()
{
TestOne();
TestTwo();
}
module;
#include <vtkCubeSource.h>
#include <vtkSmartPointer.h>
export module Test:Two;
void TestTwo()
{
vtkNew<vtkCubeSource> cube;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment