2016-04-22 21 views
1

私はがMBEDオンラインコンパイラでうまくコンパイルが、私はそれをコンパイルしようとするとlocalYそれがで失敗gcc4mbed使用して、プロジェクトがあります。gcc4mbedコンパイラの問題(C++)

MbedJSONValue.h:356:9: error: expected unqualified-id before '--' token 
    int getc() { 
     ^
MbedJSONValue.h:356:9: error: expected ')' before '--' token 
MbedJSONValue.cpp:244:1: error: expected '}' at end of input 
    } 
^
In file included from MbedJSONValue.cpp:1:0: 
MbedJSONValue.h:354:51: error: expected unqualified-id at end of input 
    input(const char * first, const char * last) {}; 
               ^
make[2]: *** [NRF51822/MbedJSONValue.o] Error 1 
make[1]: *** [MbedJSONValue] Error 2 

コードセグメントのルックスをこのように:

346: class input { 
347: protected: 
348:  const char * cur_; 
349:  const char * end_; 
350:  int last_ch_; 
351:  bool ungot_; 
352:  int line_; 
353: public: 
354:  input(const char * first, const char * last) : cur_(first), end_(last), last_ch_(-1), ungot_(false), line_(1) {}; 
355: 
356: int getc() { 
357:  if (ungot_) { 
358:   ungot_ = false; 
359:   return last_ch_; 
360:  } 
361:  if (cur_ == end_) { 
362:   last_ch_ = -1; 
363:   return -1; 
364:  } 
365:  if (last_ch_ == '\n') { 
366:   line_++; 
367:  } 
368:  last_ch_ = *cur_++ & 0xff; 
369:  return last_ch_; 
370: } 
+0

問題には関係ありませんが、コンストラクタ定義後のセミコロンは必要ありません。 –

+0

@JoachimPileborgありがとう、もしmcc onlineと同じオプションでgcc4mbedをコンパイルする方法や、gcc4mbedに代わるものがあるかどうか考えてもらえますか? – wmmhihaa

答えて

2

#include <cstdio>#include <stdio.h>を交換し、問題を解決しました。