これが私のコードです:
34
35 /**
36 ** \file position.hh
37 ** Define the example::position class.
38 */
39
40 #ifndef BISON_POSITION_HH
41 #define BISON_POSITION_HH
42
43 #include <iostream>
44 #include <string>
45
46 namespace example
47 {
48 /// Abstract a position.
49 class position
50 {
51 public:
52
53 /// Construct a position.
54 position ()
55 : filename (0), line (1), column (0)
56 {
ありがとう、スピーダー、それは素晴らしい。ネクロリス、ありがとうございます。二人とも編集ユニットの同じトラックにいます。完全なエラーレポートは次のとおりです。
location.hh:45、parser.h:64、scanner.h:25、scanner.ll:8からインクルードされたファイル:position.hh:46:エラー:「namespace」の前にunqualified-idが必要です</ p >>
location.hhは次のようになります。
35 /**
36 ** \file location.hh
37 ** Define the example::location class.
38 */
39
40 #ifndef BISON_LOCATION_HH
41 # define BISON_LOCATION_HH
42
43 # include <iostream>
44 # include <string>
45 # include "position.hh"
46
47 namespace example
48 {
49
50 /// Abstract a location.
51 class location
52 {
53 public:
また、これらのファイルはbisonによって生成されていることも付け加えておきます。この段階に到達するのは、flex++によって生成されたc++スキャナークラスをコンパイルしようとしたときです。flex --c ++ -oScanner.ccscanner.llを発行して.ccコードを取得します。