2012-03-06 7 views
0

Visual Studio 2010を使用してコンパイルするC++ Windowsアプリケーションがあります。 Windows7-64 PC)。 g ++がxaudio2.hヘッダーファイルを処理するとき、私は以下のエラーを受け取ります。誰も、インクルードファイルを手動でハックする以外に修正プログラムを知っていますか?ここでg ++ 4.6.1を使用するxaudio2.hをインクルードしようとすると、多くのC++コンパイルエラーが発生する

SDKS/DX/Include/xaudio2.h:51:1: error: pasting "5a508685" and "-" does not give 
a valid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "-" and "a254" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "a254" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "-" and "4fba" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "4fba" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "-" and "9b" does not give a vali 
d preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "9b82" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:51:1: error: pasting "-" and "9a" does not give a vali 
d preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "db05ea35" and "-" does not give 
a valid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "-" and "0329" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "0329" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "-" and "4d4b" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "4d4b" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "-" and "a5" does not give a vali 
d preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "a53a" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:52:1: error: pasting "-" and "6d" does not give a vali 
d preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "8bcf1f58" and "-" does not give 
a valid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "-" and "9fe7" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "9fe7" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "-" and "4583" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "4583" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "-" and "8a" does not give a vali 
d preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "8ac6" and "-" does not give a va 
lid preprocessing token 
SDKS/DX/Include/xaudio2.h:53:1: error: pasting "-" and "e2" does not give a vali 
d preprocessing token 
In file included from common/system.h:71:0, 
       from game.cpp:1: 
SDKS/DX/Include/xaudio2.h:65:69: fatal error: sal.h: No such file or directory 
compilation terminated. 

xaudio2.hの行です:

DEFINE_CLSID(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); 
DEFINE_CLSID(XAudio2_Debug, db05ea35, 0329, 4d4b, a5, 3a, 6d, ea, d0, 3d, 38, 52); 
DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); 

はと定義としてcomdecl.hであるように見えます:

#define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 
      class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \ 
      EXTERN_C const GUID CLSID_##className 

#define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ 
      interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \ 
      EXTERN_C const GUID IID_##interfaceName 
+1

インクルードファイル*の外観はどうですか? –

+0

私は質問にその行を追加しました。 – KPexEA

+2

有効でない '-'文字を含むプリプロセッサトークンを生成しようとしています。おそらくMicrosoft C++はこれを多くの拡張機能の1つとしてサポートしています。残念ながら、これをハッキングせずに標準のプリプロセッサで取得することはほとんどありません。 –

答えて

1

作品のトリックを発見しました。 XAudio2をCのように、C++のように含めます。

#undef __cplusplus 
#include <xaudio2.h> 
#define __cplusplus 
関連する問題