这是示例CPP文件,其中包含GCP头文件:
#include <google/cloud/storage/client.h>
#include <iostream>
int main(int argc, char* argv[]) {
std::cout << "here i am!" << std::endl;
}
这是CMake文件:
add_subdirectory(gcp/super)
include_directories(gcp)
set(MYSRC mycode.cc)
add_executable(mycode ${MYSRC})
target_link_libraries(mycode storage_client)
但是会引发错误:
In file included from /home/morteza/google-cloud-cpp-0.20.0/mycode.cc:1:
/home/morteza/google-cloud-cpp-0.20.0/gcp/google/cloud/storage/client.h:18:10: fatal error: google/cloud/internal/disjunction.h: No such file or directory
18 | #include "google/cloud/internal/disjunction.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/mycode.dir/build.make:63: CMakeFiles/mycode.dir/mycode.cc.o] Error 1
如您所见,这完全是GCP的内部部分(client.h
包括disjunction.h
)。