Kinect を処理する DLL を使用するコンソール アプリケーションを作成しようとしました。プロジェクトをビルドすると、次のようになります。
2>e:\projects\c++\vs\kinect dll\consoleapplication1\consoleapplication1.cpp(4): 警告 C4627: '#include "KinectDLL.h"': プリコンパイル済みヘッダーの使用を探すときにスキップされました 2> 'stdafx にディレクティブを追加します.h' またはプリコンパイル済みヘッダーを再構築します 2> e:\michał\projects\c++\vs\kinect dll\kinect dll\depthreader.h(4): 致命的なエラー C1083: インクルード ファイルを開けません: 'NuiApi.h': そのようなものはありませんファイルまたはディレクトリ
注: ConsolApplication1 と Kinect DLL は、同じソリューション内の 2 つのプロジェクトです。最初の 1 つには 1 つの依存関係 (DLL としての Kinect DLL プロジェクト) があります。両方のプロジェクトで「プリコンパイル ヘッダーを使用する」をオフにしました。
Kinect DLL プロジェクト:
KinectDLL.h:
#ifdef KINECTDLL_EXPORTS
#define KINECTDLL_API __declspec(dllexport) 
#else
#define KINECTDLL_API __declspec(dllimport) 
#endif
DepthReader.h:
#pragma once
#include <ole2.h>
#include <Windows.h>
#include "NuiApi.h"
#include "KinectDLL.h"
namespace KinectDLL{
    class DepthReader{
        static KINECTDLL_API const int        depthWidth  = 640;
        static KINECTDLL_API const int        depthHeight = 480;
        static KINECTDLL_API const int        bytesPerPixel = 4;
    public:
        KINECTDLL_API DepthReader(void);
        KINECTDLL_API ~DepthReader(void);
        KINECTDLL_API int Run(HINSTANCE hInstance, int nCmdShow);
    private:
        HANDLE depthStreamHandle;
        HANDLE nextDepthFrameEvent;
        HANDLE depthStream;
        BYTE* depthRGBX;
        bool nearMode;
        INuiSensor* sensor;
        //HWND m_hWnd;
        HRESULT CreateFirstConnected();
        void Update();
        void ProcessDepth();
    };
}
DepthReader.cpp
#include "stdafx.h"
#include "DepthReader.h"
namespace KinectDLL{
    DepthReader::DepthReader(void) :
        nextDepthFrameEvent(INVALID_HANDLE_VALUE),
        depthStreamHandle(INVALID_HANDLE_VALUE),
        nearMode(false),
        sensor(NULL)
    {
        // create heap storage for depth pixel data in RGBX format
        depthRGBX = new BYTE[depthWidth*depthHeight*bytesPerPixel];
    }
...など、主にMS Kinectの例からコピーして貼り付けます...
Consoleapplication1 プロジェクト:
Consoleapplication1.cpp:
#include "KinectDLL.h"
#include "stdafx.h"
#include "Rotations.h"
#include "Camera.h"
#include "FileLoader.h"
#include "DepthReader.h"
using namespace std;
Camera camera;
Rotations rotations;
FileLoader fileLoader;
KinectDLL::DepthReader depthReader;
…次に、OpenGL、ファイルからのポイントがあります。シーンのデータを表示するためではなく、シーンを制御するために Kinect を使用しています。現在、depthReader はありません。
明らかに私は何かばかげたことをしているのですが、何がわかりません。VC++ の DLL に関する Microsoft の例を読んでいますが、何が問題なのかわかりません。