Hi, You need to add .cc and .h to ARROW_SRCS. For ORC related .cc and .h, https://github.com/apache/arrow/blob/master/cpp/src/arrow/CMakeLists.txt#L466 is the best location to do it.
Thanks, -- kou In <7b643229-615d-44d6-856a-98609e4af...@gmail.com> "[C++][CMake] How to add new .cc & .h files?" on Tue, 9 Mar 2021 00:30:13 -0500, Ying Zhou <yzhou7...@gmail.com> wrote: > Hi, > > Right now I’m working on ARROW-11297 which adds WriterOptions to the > ORCWriter (and will be a separate PR). After adding new files > (adapter_options.h & adapter_options.cc <http://adapter_options.cc/>) I found > that src/arrow/CMakeFiles/arrow_objlib.dir/adapters/orc/adapter_options.cc.o > doesn’t exist and as a result ld obviously can not find the symbols that > should be contained in it even though I use ARROW_EXPORT to indicate that > arrow::adapters::orc::WriterOptions does need to be exported. I wonder > whether there is some setting in CMake I should change in order to fix that. > > Here is the error message: > > [ 89%] Linking CXX executable ../../../../debug/arrow-orc-adapter-test > Undefined symbols for architecture x86_64: > "arrow::adapters::orc::WriterOptions::WriterOptions()", referenced from: > arrow::AssertTableWriteReadEqual(std::__1::shared_ptr<arrow::Table> > const&, std::__1::shared_ptr<arrow::Table> const&, long long) in > adapter_test.cc.o > "arrow::adapters::orc::WriterOptions::~WriterOptions()", referenced from: > arrow::AssertTableWriteReadEqual(std::__1::shared_ptr<arrow::Table> > const&, std::__1::shared_ptr<arrow::Table> const&, long long) in > adapter_test.cc.o > > "arrow::adapters::orc::AdaptWriterOptions(arrow::adapters::orc::WriterOptions > const&)", referenced from: > arrow::adapters::orc::ORCFileWriter::Impl::Write(arrow::Table const&, > arrow::adapters::orc::WriterOptions const&) in libarrow.a(adapter.cc.o) > ld: symbol(s) not found for architecture x86_64 > clang-11: error: linker command failed with exit code 1 (use -v to see > invocation) > make[3]: *** [debug/arrow-orc-adapter-test] Error 1 > make[2]: *** > [src/arrow/adapters/orc/CMakeFiles/arrow-orc-adapter-test.dir/all] Error 2 > make[1]: *** [CMakeFiles/unittest.dir/rule] Error 2 > make: *** [unittest] Error 2 > > > Ying