2017-06-29 8 views
0

私はレーシングゲームに取り組んでいたので、ハンドルサポートを追加したいと思います。私はUWP(here is the page)を使用しています。 Microsoftがあなたがすべきことを言うようにappxmanifestにコードを追加しましたが、まだエラーメッセージが表示されます。C++ UWP実装

RacingWheel::RacingWheels 

-Nameが続く:

Input.cpp

#include "pch.h" 
#include "Input.h" 
#include <vector> 
#include <Windows.h> 
#include <windows.gaming.input.h> 
#include <windows.gaming.input.custom.h> 
#include <windows.gaming.input.forcefeedback.h> 

Input::Input() 
{ 

} 

bool Input::Detect() 
{ 
    Windows::Gaming::Input::RacingWheel RacingWheel; 

    auto Wheels = ref new Vector<RacingWheel^>(); 

    for (auto racingwheel : RacingWheel::RacingWheels) 
    { 
     Wheels->Append(racingwheel); 
    } 
}; 

次のようにエラーがある

#pragma once 
#include <windows.gaming.input.h> 
#include <windows.gaming.input.custom.h> 
#include <windows.gaming.input.forcefeedback.h> 

ref class Input sealed 
{ 
public: 
    Input(); 
    bool Detect(); 

private: 
    void Acquire(); 

}; 

Input.h:ここでのコードは::クラスまたは名前空間でなければならない

Vector<RacingWheel^> 

-expectedタイプ識別子

私はCに新たなんだが-expected ++ので、任意のヘルプは大歓迎です。

+0

これはC++ではありません。それはC++/CLIですか? –

答えて

2

C++/Cxと通常のC++を混在させています。 C++で書いている場合は、ref^の構文を使用することはできません。代わりに普通のCOMを使用する必要があります。#include <windows.gaming.input.h>などのUWPヘッダーを含める必要はありませんが、C++/Cxとしてコンパイルする必要があります。適切な種類のVSプロジェクトを作成します。

また、Windows 10 Anniversary Edition(10.0.14393)をターゲットにしていることを確認する必要がありますので、Wheelが利用可能です。