2017-10-27 1 views
0

는 여기 . 몇 가지 다른 버전이 있지만 이것은 내가 찾은 것 중 가장 작은 버전입니다.Visual Studio에서 오류를 '네임 스페이스/클래스를 찾을 수 없습니다'나는 다이렉트 X 11 튜토리얼을 따라하려고 2015

C2653 'Platform': is not a class or namespace name  
C3861 'CreateException': identifier not found  
C2039 'Storage': is not a member of 'Windows'  
C2871 'Storage': a namespace with this name does not exist  
C3083 'ApplicationModel': the symbol to the left of a '::' must be a type 
C3083 'Package': the symbol to the left of a '::' must be a type 
C2039 'Current': is not a member of 'Windows'  
C2065 'Current': undeclared identifier  

내가 무엇을 제출해야 할 지 모르겠습니다 또는 내가 무엇을 포함해야합니다 : 나는 그것을 포함하여 컴파일 할 때

문제는, 내가 같은 오류를 얻을. 나는에 대한 검색을 수행 할 때
플랫폼 :: 예외 :: CreateException (시간) 내가 C에서 fidnit : \ PROGRAM FILES (86) MICROSOFT VISUAL STUDIO \ 14.0 \ VC \ LIB \ 스토어 \

PLATFORM.WINMD \ 참조

나는 이것을 어떻게 참조해야하는지 잘 모르겠다.

//DirectXHelper.h 
#pragma once 

#include <ppltasks.h> // For create_task 

namespace DX 
{ 
    inline void ThrowIfFailed(HRESULT hr) 
    { 
     if (FAILED(hr)) 
     { 
      // Set a breakpoint on this line to catch Win32 API errors. 
      throw Platform::Exception::CreateException(hr); 
     } 
    } 

    // Function that reads from a binary file asynchronously. 
    inline Concurrency::task<std::vector<byte>> ReadDataAsync(const std::wstring& filename) 
    { 
     using namespace Windows::Storage; 
     using namespace Concurrency; 

     auto folder = Windows::ApplicationModel::Package::Current->InstalledLocation; 

     return create_task(folder->GetFileAsync(Platform::StringReference(filename.c_str()))).then([](StorageFile^ file) 
     { 
      return FileIO::ReadBufferAsync(file); 
     }).then([](Streams::IBuffer^ fileBuffer) -> std::vector<byte> 
     { 
      std::vector<byte> returnBuffer; 
      returnBuffer.resize(fileBuffer->Length); 
      Streams::DataReader::FromBuffer(fileBuffer)->ReadBytes(Platform::ArrayReference<byte>(returnBuffer.data(), fileBuffer->Length)); 
      return returnBuffer; 
     }); 
    } 

    // Converts a length in device-independent pixels (DIPs) to a length in physical pixels. 
    inline float ConvertDipsToPixels(float dips, float dpi) 
    { 
     static const float dipsPerInch = 96.0f; 
     return floorf(dips * dpi/dipsPerInch + 0.5f); // Round to nearest integer. 
    } 
} 

참고 : 나는 Win32 콘솔 응용 프로그램 및 Win32 응용 프로그램으로 이것을 구축을 시도 같은 오류가 ThrowIfFailed의 버전이 C++/CX (일명 /ZW를 사용하여 UWP 응용 프로그램을 구축하는 가정 것을

+0

튜토리얼 어떻게 프로젝트가 정확한 프로젝트 템플릿에서 시작하는 방법을 알려하지 않았다. 파일> 새로 만들기> 프로젝트> Visual C++> Windows> 유니버설> DirectX 11 App. 이러한 컴파일 오류를 피하는 많은 것들을 설정합니다. 그리고 Common 폴더 안에 DirectXHelper.h를 제공합니다. –

답변

1

등장). 이 자습서에서는 Windows 10의 UWP 플랫폼 용 DirectX 11 App 템플릿을 시작으로 사용한다고 가정합니다.

당신은 (/EHsc 사용)로 C++에 대한보다 일반적인의 하나를 쓸 수 있습니다 :

#include <exception> 

namespace DX 
{ 
    inline void ThrowIfFailed(HRESULT hr) 
    { 
     if (FAILED(hr)) 
     { 
      // Set a breakpoint on this line to catch DirectX API errors 
      throw std::exception(); 
     } 
    } 
} 

이 도우미에 대한 자세한 내용은 ThrowIfFailed를 참조하십시오.

는 Win32 데스크톱 애플 리케이션을위한 작동 ReadDataAsync 도우미의 버전은 here를 찾을 수 있습니다.

ConvertDipsToPixels은 UWP 애플 리케이션을위한 필요하다.

당신은 Win32에서 데스크탑 애플리케이션, UWP 애플 리케이션, 윈도우 전화 8.x에서, X 박스 하나 XDK 애플리케이션을 지원 다이렉트 도구 키트tutorials 살펴 보셔야합니다.

+0

감사합니다. 이걸 살펴보고 DirectX 툴킷을 사용하고 있지만 사용자 정의 OBJ 파일 - 메쉬 변환기를 만들고 싶습니다. DXTK는 꼭지점과 인덱스에서 메쉬를 만들기위한 기능을 제공하지 않습니다. DXTK의 소스 코드를 수정하지 않고이 작업을 수행 할 수있는 방법이 있는지 알고 있습니까? – Mich

+0

[DirectXMesh] (https://github.com/Microsoft/DirectXMesh)에는 Wavefront OBJ 파일을''CMO'',''SDKMESH'' 및/또는''SDKMESH''로 간단히 변환하기위한''meshconvert'' 도구가 포함되어 있습니다. 'VBO'. 참고 glTF2 지원 작업 중입니다. –

관련 문제