这个问题注定要重复一遍,直到所有具体情况都用尽为止。但这一次确实令人费解,因为解决“包括”通常不是一个问题。
SITUATION
艾德: Nsight
库达变容:库达-9.0
可计算性: 3.7
程序结构
main.cu
|
#include GPU_in_grig.cuh - defines class and C-structures with serialization functions
| - #includes <cereal/archives/binary.hpp>
#include NN_def.cuh - defines C-structure, also with serialization functions
- #includes <cereal/archives/binary.hpp> <- ERROR误差
14:14:19 ** Incremental Build of configuration Debug for project cuda_managed_v0_2 **
make all
Building file: ../source_code/main.cu
Invoking: NVCC Compiler
/usr/local/cuda-9.0/bin/nvcc -I"/home/mgaraj/cuda-workspace/cuda_managed_v0_2/source_code/cereal" -G -g -O0 -std=c++11 -gencode arch=compute_37,code=sm_37 -odir "source_code" -M -o "source_code/main.d" "../source_code/main.cu"
In file included from ../source_code/GPU_in_grid.cuh:15:0,
from ../source_code/main.cu:9:
../source_code/NN_def.hpp:18:38: fatal error: cereal/archives/binary.hpp: No such file or directory
compilation terminated.
make: * [source_code/main.o] Error 1
source_code/subdir.mk:21: recipe for target 'source_code/main.o' failed
14:14:19 Build Finished (took 172ms)麦谷
对于那些不熟悉谷物库的人来说,这只是头库,只是复制粘贴到文件夹source_code中,所有的代码都存放在文件夹中。

上面显示的文件有问题,导致编译错误。请注意,该文件位于源代码/谷物/档案中,这是-谷物/档案/binary.hpp-因为错误投诉。
我的代码
#ifndef NN_DEF_H_
#define NN_DEF_H_
//==========================================================//
// INCLUDES //
//==========================================================//
// std::cout
#include <iostream>
// Cereal - serialization
#include <cereal/archives/binary.hpp>
#include <cereal/archives/portable_binary.hpp>
//==========================================================//
// PARAMETERS //
//==========================================================//
// OMITTED
//==========================================================//
// CLASS DEFINITION //
//==========================================================//
class NN{
public:
bool check_limits(void);
void print(void);
public:
//==========================//
// CONTENT //
//==========================//
float weight[NN_layer][NN_neuron][NN_weight];
// ensure the size of NN_layout equals the NN_layer parameter
int layout[NN_layer] = NN_layout;
// debugging parameter
int debug;
//==========================//
// SERIALIZATION //
//==========================//
// function required by cereal library
template<class Archive>
void serialize(Archive & ar){
ar( cereal::binary_data( weight , sizeof(float) * NN_layer * NN_neuron * NN_weight));
ar( cereal::binary_data( layout , sizeof(float) * NN_layer) );
ar( debug );
}
};
//==========================================================//
// FUNCTION DEFINITION //
//==========================================================//
bool NN::check_limits(void){
// OMITTED
};
void NN::print(void){
// OMITTED
}
#endif /* NN_DEF_H_ */我为处理错误所做的事情
问题
为什么错误如此持久?NVCC编译器会导致问题吗?这和我的密码有关吗?
发布于 2017-11-30 09:39:35
NVCC (或仅仅是编译器)在提供-I选项“/source_code/NVCC”时,不理解与#include“NVCC/ doesnt /binary.hpp”的重叠。重叠是包含在两个路径中的“both /”目录。
只需让编译器知道-I = "/source_code",就可以解决这个问题,因为#include“code/ solves /binary.hpp”随后会被附加到-I选项中,从而生成“-I_code/code/solves/binary.hpp”路径。
https://stackoverflow.com/questions/47567529
复制相似问题