chaincodelabs / libmultiprocess

C++ library and code generator making it easy to call functions and reference objects in different processes
MIT License
29 stars 20 forks source link

Fix compilation of foo.h: include <string> #19

Closed vasild closed 4 years ago

vasild commented 4 years ago

std::string is used inside foo.h but it forgot to include the corresponding header:

[ 53%] Building CXX object CMakeFiles/mptest.dir/src/mp/test/foo.capnp.proxy-server.c++.o
/usr/bin/c++   -I/usr/local/lib/cmake/CapnProto/../../../include -IBUILD/libmultiprocess/include -ISOURCE/libmultiprocess/include -ISOURCE/libmultiprocess/src -IBUILD/libmultiprocess/src -isystem /usr/local/include -D_THREAD_SAFE -pthread -std=gnu++14 -o CMakeFiles/mptest.dir/src/mp/test/foo.capnp.proxy-server.c++.o -c BUILD/libmultiprocess/src/mp/test/foo.capnp.proxy-server.c++
In file included from BUILD/libmultiprocess/src/mp/test/foo.capnp.proxy-server.c++:3:
In file included from BUILD/libmultiprocess/src/mp/test/foo.capnp.proxy-types.h:6:
In file included from BUILD/libmultiprocess/src/mp/test/foo.capnp.proxy.h:7:
SOURCE/libmultiprocess/src/mp/test/foo.h:17:17: error: implicit
      instantiation of undefined template 'std::__1::basic_string<char, std::__1::char_traits<char>,
      std::__1::allocator<char> >'
    std::string name;
                ^
/usr/include/c++/v1/iosfwd:210:32: note: template is declared here
    class _LIBCPP_TEMPLATE_VIS basic_string;
                               ^
1 error generated.
...

$ c++ --version
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd12.1
Thread model: posix
InstalledDir: /usr/bin
ryanofsky commented 4 years ago

Code review ACK c92112a786f47782aba1a512b667bed5e0788ee5.

Good catch, a missing include also caused some problems for me in https://github.com/chaincodelabs/libmultiprocess/pull/16#issuecomment-571308678. A long time ago I had IWYU working on this code. I should probably get that working again to avoid more bugs like these.

vasild commented 4 years ago

A long time ago I had IWYU working on this code. I should probably get that working again to avoid more bugs like these.

https://github.com/chaincodelabs/libmultiprocess/issues/20 Integrate iwyu so that it does not get forgotten.