Linux. He generated the kaitai project, the files, so there should be no problems with headers and generally with code.

Here is a CMake

cmake_minimum_required(VERSION 3.7) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14) set (HEADERS ethernet_frame.h icmp_packet.h ipv4_packet.h ipv6_packet.h pcap.h tcp_segment.h udp_datagram.h) set(SOURCE_FILES ethernet_frame.cpp icmp_packet.cpp ipv4_packet.cpp ipv6_packet.cpp pcap.cpp Source.cpp tcp_segment.cpp udp_datagram.cpp Source.cpp) #set (SOURCES_LIB kaitai/kaitaistream.cpp) #set(HEARERS_LIB kaitai/kaitaistream.h kaitai/kaitaistruct.h) #add_library (kaitai STATIC ${HEADERS_LIB} ${SOURCES_LIB}) include_directories(kaitai) add_subdirectory(kaitai) #target_link_libraries(Source.cpp kaitai) add_executable(PcapCatalog ${HEADERS} ${SOURCE_FILES}) 

These are the CLIon errors

CMakeFiles / PcapCatalog.dir / ethernet_frame.cpp.o: In function ethernet_frame_t :: ethernet_frame_t (kaitai :: kstream *, kaitai :: kstruct *, ethernet_frame_t *) ': /home/cryctal/CLionProjects/Pccccctctc)> : undefined reference to kaitai :: kstream :: read_bytesabi: cxx11 '/home/cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:12: undefined reference to kaitai :: kstream :: read_bytesabi: cxx11' / home / cryztal / CLionProjects / Pc :: read_bytesabi / cxx11 '/ home / cryztal / CLionProjects / Pc :: read_bytesabi: /ethernet_frame.cpp:13: undefined reference to kaitai :: kstream :: read_u2be () '/home/cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:16: undefined reference to kaitai :: kstream :: read_bytes_fullabi: cxx11' / home /cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:17: undefined reference to
kaitai :: kstream :: kstream (std :: __ cxx11 :: basic_string std :: char_traits, std :: allocator> &) '/home/cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:21: undefined reference to kaitai :: kstream :: read_bytes_fullabi: cxx11 '/home/cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:22: undefined reference to kaitai :: kstream :: kstream (std :: __ cxx11 :: basic_string, std :: allocator> &) / home /cryztal/CLionProjects/PcapCatalog/ethernet_frame.cpp:26: unqualified reference to kaitai :: kstream :: read_bytes_fullabi: cxx11 'CMakeFiles / PcapCatalog.dir / icmp_packet.cpp.o: In function icmp_packet_t :: icmpet- app / update / icmp_packet.cpp.o: In function icmp_packet_t :: icmpet4et.pir / icmp_packet.cpp. , kaitai :: kstruct *, icmp_packet_t *) ': /home/cryztal/CLionProjects/PcapCatalog/icmp_packet.cpp:11: undefined reference to kaitai :: kstream :: read_u1 ()' CMakeFiles / PcapCatalog.dir / icmp_packet.cpp. o: In function icmp_packet_t :: destination_unreachable_msg_t :: destination_unreachable_msg_t (kaitai :: kstream *, icmp_packet_t *, icmp_packet_t *) ': /home/cryztal/CLionProjects/PcapCatalog/icmp_packet.cpp : 44: undefined reference kaitai :: kstream :: read_u1 () '/home/cryztal/CLionProjects/PcapCatalog/icmp_packet.cpp:45: undefined reference to kaitai :: kstream :: read_u2be ()' CMakeFiles / PcapCatalog.dir / icmp_packet. : kstream :: read_u1 () '/home/cryztal/CLionProjects/PcapCatalog/icmp_packet.cpp: undefined reference to kaitai :: kstream :: read_u2be ()' CMakeFiles / PcapCatalog.dir / icmp_packet.cpp.o: In function icmp_packet_t :: echo_msg_t :: echo_msg_t (kaitai :: kstream *, icmp_packet_t *, icmp_packet_t *) ':

    1 answer 1

    Judging by the conclusion, the linker swears that he did not find the library. And apparently, her name is kaitai. Moreover, I see an attempt to add it as a library, but commented out. But only target_link_libraries should be after add_executable, otherwise it will not work.

    • Thank. I solved this problem) - Max Cryztal