file file testmodule.ixx < /p>
Код: Выделить всё
export module testModule;
int foo();
< /code>
файл реализации testmodule.cpp < /p>
module testModule;
int foo() {
// some implementation
}
< /code>
Как мне нужно указать файл реализации в соответствующей цели в
cmakelists.txt?
Это то, что я попробовал: < /p>
add_library(moduleTest)
target_sources(moduleTest
PRIVATE FILE_SET CXX_MODULES FILES
ModuleTest.ixx
PRIVATE
ModuleTest.cpp
)
target_compile_features(moduleTest PUBLIC cxx_std_20)
target_compile_options(moduleTest PRIVATE "-fmodules-ts")
< /code>
Сообщение об ошибке: < /p>
moduleTest: error: failed to read compiled module: No such file or directory
moduleTest: note: compiled module file is 'gcm.cache/moduleTest.gcm'
moduleTest: note: imports must be built before being imported
moduleTest: fatal error: returning to the gate for a mechanical issue
Подробнее здесь: https://stackoverflow.com/questions/796 ... elists-txt
Полная версия