0

スレッドプールの実装では:

仮想クラスのスレッドプールを持つ threadpool.h があります。

class ThreadPool {
     funcX (){} = 0
     ...
}
// ThreadPoolImpl not defined or declared in this file.

対応する threadpool.cpp には、threadpool から継承する実装 threadpoolImpl があります。

//include threadpool.h header.
class ThreadPoolImpl : public ThreadPool {
      funcX() {....};  // The function I want to debug inside.
}

私の問題:

私の主な機能で: もし私が threadpool.h だけをインクルードすると、'threadpoolImpl の定義が不足しているために、

incomplete type not allowed error.

threadpool.h の代わりに threadpool.cpp をインクルードすると、threadpool.cpp が 2 回コンパイルされるため、リンク エラーが発生します。これを解決するために、プロジェクトから threadpool.cpp を削除しました。ただし、この方法では、ブレークポイントを使用して threadpool.cpp をデバッグできません。

threadpoolImpl をデバッグしながら (VS IDE ツールを使用して) 使用できるかどうかを誰かに教えてください。それとも書き直す必要がありますか?

4

2 に答える 2