静态4.7 Omnet ++ 5.3在Windows 7中构建错误

时间:2018-06-03 17:14:56

标签: c++ windows-7 omnet++ veins sumo

我是静脉和omnet ++的新手。我按照本教程http://veins.car2x.org/tutorial/一切都可以执行第3步,出于某种原因,静脉4.7不会在omnet ++ 5(IDE)中构建并生成以下错误。

veins/modules/utility/TimerManager.cc
In file included from veins/modules/utility/TimerManager.cc:20:
.\veins/modules/utility/TimerManager.h:137:26: error: expected identifier
  enum class StartMode { RELATIVE, ABSOLUTE, IMMEDIATE };
                         ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
In file included from veins/modules/utility/TimerManager.cc:20:
.\veins/modules/utility/TimerManager.h:137:36: error: expected identifier
  enum class StartMode { RELATIVE, ABSOLUTE, IMMEDIATE };
                                   ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
In file included from veins/modules/utility/TimerManager.cc:20:
.\veins/modules/utility/TimerManager.h:138:24: error: expected identifier
  enum class EndMode { RELATIVE, ABSOLUTE, REPITITION, OPEN };
                       ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
In file included from veins/modules/utility/TimerManager.cc:20:
.\veins/modules/utility/TimerManager.h:138:34: error: expected identifier
  enum class EndMode { RELATIVE, ABSOLUTE, REPITITION, OPEN };
                                 ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:42:28: error: expected unqualified-id
  start_mode_ = StartMode::RELATIVE;
                           ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
veins/modules/utility/TimerManager.cc:48:28: error: expected unqualified-id
  start_mode_ = StartMode::ABSOLUTE;
                           ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:54:24: error: expected unqualified-id
  end_mode_ = EndMode::RELATIVE;
                       ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
veins/modules/utility/TimerManager.cc:60:24: error: expected unqualified-id
  end_mode_ = EndMode::ABSOLUTE;
                       ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:86:19: error: expected unqualified-id
  case StartMode::RELATIVE:
                  ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
veins/modules/utility/TimerManager.cc:88:30: error: expected unqualified-id
    start_mode_ = StartMode::ABSOLUTE;
                             ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:90:19: error: expected unqualified-id
  case StartMode::ABSOLUTE:
                  ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:98:17: error: expected unqualified-id
  case EndMode::RELATIVE:
                ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1434:18: note: expanded from macro 'RELATIVE'
#define RELATIVE 2
                 ^
veins/modules/utility/TimerManager.cc:100:26: error: expected unqualified-id
    end_mode_ = EndMode::ABSOLUTE;
                         ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:102:17: error: expected unqualified-id
  case EndMode::ABSOLUTE:
                ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
veins/modules/utility/TimerManager.cc:106:26: error: expected unqualified-id
    end_mode_ = EndMode::ABSOLUTE;
                         ^
C:\Users\Abu\src\omnetpp-5.3\tools\win64\mingw64\x86_64-w64-mingw32\include\wingdi.h:1433:18: note: expanded from macro 'ABSOLUTE'
#define ABSOLUTE 1
                 ^
15 errors generated.
make[1]: *** [Makefile:205: ../out/clang-debug/src/veins/modules/utility/TimerManager.o] Error 1
make[1]: Leaving directory '/c/Users/Abu/src/veins-4.7/src'
make: *** [Makefile:12: all] Error 2

我也在使用sumo_win64_0.32.0。我不确定导致这些错误的原因。

非常感谢任何帮助。

3 个答案:

答案 0 :(得分:2)

此问题已在filter(Predicate<? super T> predicate)中修复,并且已发布新的静脉修订版(即this pull request)。请下载新版本以获得修复,并进行一些其他改进。

答案 1 :(得分:1)

我刚刚遇到了这个错误,这就是发生的事情:

编译器无法解析 TimerManager.h 中的enum class定义,因为 wingdi中的宏RELATIVEABSOLUTE存在名称歧义.H

enum class StartMode { RELATIVE, ABSOLUTE, IMMEDIATE };

enum class EndMode { RELATIVE, ABSOLUTE, REPITITION, OPEN };

快速修复是将 TimerManager.h TimerManager.cc 中的实例重命名为其他内容。例如。将所有RELATIVE替换为RELATIVEINSABSOLUTE替换为ABSOLUTEVEINS等等(或任何您喜欢的内容)。 4.7和OMNet ++ 5.2.1为我工作得很好。

答案 2 :(得分:1)

需要使用补丁来使用OMNeT ++ 5.3 for Windows编译Veins 4.7。最干净的方式可能类似于https://pastebin.com/ymzqMpEF

- enum class StartMode { RELATIVE, ABSOLUTE, IMMEDIATE }
+ enum class StartMode { relative, absolute, immediate }

即将全大写enum class常量重命名为小写常量(也是许多编码样式推荐的内容)。