方法を設定します。を渡すのstd ::以下prerequisits考えるとC++
shared.h
struct A {
int x;
int y;
}
typedef set<A> setOfA;
implementation1.cpp
#include "shared.h"
void Implementation1::someFunction()
{
//...
setOfA setinstance;
//...
Implementation2* i = new Implementation2();
i->functionF(setinstance);
}
implementation2.h
#include "shared.h"
void Implementation2::functionF(setOfA&);
EDIT:今、これは明確にする必要があります...
私は別のクラスの別の関数にsetOfA
を渡したい - すべてがうまくコンパイルされます。右、実装が見つかりませんでした - 'implementation::functionF(std::set<A, std::less<A>, std::allocator<A> >&)'
へ
未定義参照ちょうどそれが権利を取得するために:私は、次のリンカ問題を取得しますか?すべてがコンパイルされているので、これはtypedefの問題ではありません...私はここで何が欠けていますか?
あなたのタイプ 'A'には省略した'演算子 'がありますか? –
'functionF'を実装しましたか?あなたがプログラムをビルドするときにそれを含むソースファイルを含めていますか? –
@ R.MartinhoFernandesはい、同様に 'operator ==' – Eric