こんにちは私はどの部分が間違っているのだろうか?ヘッド ファイルを .h と .cpp に分離した後、コンパイラが機能しません。これらは単なるコンストラクタであるため、以前はすべて .h ファイルに入れていました。ありがとう!
Graphnode.h:
#ifndef Graphnode_H
#define Graphnode_H
#include <tr1/array>
//using namespace std;
class Graphnode {
public:
std::tr1::array<char, 16> state;
char x;
char depth;
char direction;
Graphnode(std::tr1::array<char, 16> _state,char _x,char _d,char _direction);
Graphnode();
};
#endif
グラフノード.cpp:
#include "Graphnode.h"
Graphnode::Graphnode()
{
int i=0;
for(i=0;i<16;i++)
{
state[i] = 0;
}
x = 0;
depth = 0;
direction = 0;
}
Graphnode::Graphnode(std::tr1::array<char, 16> _state,char _x,char _d,char _direction)
{
int i=0;
for(i=0;i<16;i++)
{
state[i] = _state[i];
}
x = _x;
depth = _d;
direction = _direction;
}
エラー:
ZION:ods_v3 weeo$ make local
mpic++ -o local ods_v3.cpp -L/opt/local/lib/ -lboost_iostreams-mt -lz -I/opt/local/include
Undefined symbols for architecture x86_64:
"Graphnode::Graphnode(std::tr1::array<char, 16ul>, char, char, char)", referenced from:
_main in ods_v3-semJJ5.o
"Graphnode::Graphnode()", referenced from:
bfs(Graphnode, std::tr1::array<char, 16ul>, char, std::queue<Graphnode, std::deque<Graphnode, std::allocator<Graphnode> > >&) in ods_v3-semJJ5.o
dfs(Graphnode, std::tr1::array<char, 16ul>, char, std::queue<Graphnode, std::deque<Graphnode, std::allocator<Graphnode> > >, std::queue<Graphnode, std::deque<Graphnode, std::allocator<Graphnode> > >, std::tr1::array<std::tr1::unordered_map<std::string, char, std::tr1::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, char> >, false>, 2000ul>) in ods_v3-semJJ5.o
readcheckfile(char const*, std::queue<Graphnode, std::deque<Graphnode, std::allocator<Graphnode> > >&) in ods_v3-semJJ5.o
_main in ods_v3-semJJ5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [local] Error 1