クイズの質問のバイナリ ファイルを読み取り、質問されたときにのみ回答を表示できる cpp でバックエンドを作成しようとしています。DLL リンクを使用したいので、クラス メンバーを使用しないhttp://msdn.microsoft.com/en-us/library/vstudio/ms235636.aspxの Microsoft のウォークスルーに従いました。それらもエクスポートし、クラスに特定の構造体も含めたいと思います。
基本的に、私は、クラスのオブジェクトを宣言して使用し、その DLL を自分が引き受けるプロジェクトに含めるだけで、そのメンバー関数を使用できるようにしたいと考えています。どうすればいいですか?私の次のコードでは、
#ifdef CXWDLL_EXPORTS
#define CXWAPI __declspec(dllexport)
#else
#define CXWAPI __declspec(dllimport)
#endif
#include<string>
using namespace std;
typedef unsigned long long UINT64
#define SIZE 15
#define GRIDSIZE 225
#define MAXCLUES 50
namespace cxw
{
class CXWAPI CXWPuzzle
{
public:
CXWPuzzle();
virtual ~CXWPuzzle();
struct Header
{
string signature;
string version;
short type;
} header;
struct Checksum
{
int header;
int crossie;
int grid;
int clues;
int solution;
int file;
} checksum;
struct Contents
{
struct CHeader
{
string title;
string author;
string copyright;
string notes;
} cHeader;
struct Grid
{
short size;
UINT64 grid[4];
char filled[GRIDSIZE];
UINT64 filled[4];
} grid;
struct Clues
{
string across[MAXCLUES];
string down[MAXCLUES];
} clues;
struct Solution
{
char answers[GRIDSIZE];
string across[MAXCLUES];
string down[MAXCLUES];
} solution;
} contents;
};
}
VS 2010 コンパイラは、次の場所で「エラー: 宣言が必要です」と言います:
} solution;
およびその後の閉じ括弧。クラスのメソッドはまだ追加していません。
私は何を間違っていますか?また、私のコードでは、私の要件として述べたことを実行できますか?