mutouyun / cpp-ipc

C++ IPC Library: A high-performance inter-process communication using shared memory on Linux/Windows.
Other
1.79k stars 340 forks source link

请问怎么编译demo下面的例子啊 #112

Open Xiids opened 11 months ago

Xiids commented 11 months ago

xx@ubuntu:~/my_workspace/github/cpp-ipc-master/cpp-ipc-master/demo/chat/build$ cmake .. -- The C compiler identification is GNU 9.4.0 -- The CXX compiler identification is GNU 9.4.0 -- Check for working C compiler: /usr/local/bin/cc -- Check for working C compiler: /usr/local/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/local/bin/c++ -- Check for working CXX compiler: /usr/local/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.16)

should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done -- Generating done -- Build files have been written to: /home/wangtao/my_workspace/github/cpp-ipc-master/cpp-ipc-master/demo/chat/build wangtao@ubuntu:~/my_workspace/github/cpp-ipc-master/cpp-ipc-master/demo/chat/build$ cmake --build . Scanning dependencies of target chat [ 50%] Building CXX object CMakeFiles/chat.dir/main.o /home/xx/my_workspace/github/cpp-ipc-master/cpp-ipc-master/demo/chat/main.cpp:8:10: fatal error: libipc/ipc.h: No such file or directory 8 | #include "libipc/ipc.h" | ^~~~~~ compilation terminated. make[2]: [CMakeFiles/chat.dir/build.make:63: CMakeFiles/chat.dir/main.o] Error 1 make[1]: [CMakeFiles/Makefile2:76: CMakeFiles/chat.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

谢谢

mutouyun commented 11 months ago

你应该在 cpp-ipc-master 文件夹下面建 build 文件夹,然后 cd 进去 cmake ..

NEWPLAN commented 11 months ago

go to the build path of your repo, adding flags: LIBIPC_BUILD_DEMOS, i.e., mkdir build cd build cmake -DLIBIPC_BUILD_DEMOS=ON ..