2012-02-19 42 views
-7

エラー:トークンの前に二項演算子を欠けている "("

cxx.cpp:5:13: error: missing binary operator before token "(" 
cxx.cpp:7:15: error: missing binary operator before token "(" 

コード:

#if definied(_WIN32) || definied(_WIN64) || definied(__WIN32__) 
     const char * PORT = "COM1"; 
    #elif definied(__linux) || definied(__linux__) || definied(linux) 
     const char * PORT = "dev/ttyS1"; 
    #else 
     const char * PORT = NULL; 
    #endif 

質問:コンパイラは、新しいdefined()呼び出しを待っている

  1. それを?任意のLinux(およびバリアント)またはWindowsのバージョンを検出できますか?

ありがとうございました。

+3

これはおそらく、あなたの実際のコードではないように(明確にコピーアンドペーストタイプミスです "definied")、この答えるのは難しいです。 –

+5

'definied'、本当ですか? – Mat

+0

プリプロセッサのコードサンプル全体にミスペルドが定義されています。 – talonmies

答えて

4

あなたはdefinedをスペルミス:

#if definied(_WIN32) || definied(_WIN64) || definied(__WIN32__) 

#elif definied(__linux) || definied(__linux__) || definied(linux) 

は次のようになります。

#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) 

#elif defined(__linux) || defined(__linux__) || defined(linux) 
関連する問題