Veins_inet:对__imp__ZTVN5Veins17VeinsInetMobilityE'的未定义引用在OMNet 5.1.1中构建时

时间:2017-11-29 12:06:17

标签: omnet++ veins

我在Windows-64计算机上将veins_inet子项目导入OMNet 5.1.1并尝试构建。一切顺利(构建inet和静脉),直到它开始构建veins_inet时收到此错误:

veins_inet/VeinsInetMobility.cc:41:1: warning: 'Veins::VeinsInetMobility::VeinsInetMobility()' redeclared without dllimport attribute after being referenced with dll linkage
 VeinsInetMobility::VeinsInetMobility() :
 ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:54:6: warning: 'virtual void Veins::VeinsInetMobility::preInitialize(std::__cxx11::string, const inet::Coord&, std::__cxx11::string, double, double)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 void VeinsInetMobility::preInitialize(std::string external_id, const inet::Coord& position, std::string road_id, double speed, double angle) {
      ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:61:6: warning: 'virtual void Veins::VeinsInetMobility::nextPosition(const inet::Coord&, std::__cxx11::string, double, double)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 void VeinsInetMobility::nextPosition(const inet::Coord& position, std::string road_id, double speed, double angle) {
      ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:75:8: warning: 'virtual double Veins::VeinsInetMobility::getMaxSpeed() const' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 double VeinsInetMobility::getMaxSpeed() const {
        ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:79:7: warning: 'virtual inet::Coord Veins::VeinsInetMobility::getCurrentPosition()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 Coord VeinsInetMobility::getCurrentPosition() {
       ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:83:7: warning: 'virtual inet::Coord Veins::VeinsInetMobility::getCurrentSpeed()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 Coord VeinsInetMobility::getCurrentSpeed() {
       ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:87:19: warning: 'virtual inet::EulerAngles Veins::VeinsInetMobility::getCurrentAngularPosition()' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 inet::EulerAngles VeinsInetMobility::getCurrentAngularPosition() {
                   ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:96:6: warning: 'virtual void Veins::VeinsInetMobility::initialize(int)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 void VeinsInetMobility::initialize(int stage) {
      ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:126:6: warning: 'virtual void Veins::VeinsInetMobility::handleMessage(omnetpp::cMessage*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
 void VeinsInetMobility::handleMessage(cMessage *message) {
      ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:130:6: warning: 'virtual void Veins::VeinsInetMobility::updateVisualRepresentation()' redeclared without dllimport attribute after being referenced with dll linkage
 void VeinsInetMobility::updateVisualRepresentation() {
      ^~~~~~~~~~~~~~~~~
veins_inet/VeinsInetMobility.cc:137:6: warning: 'virtual void Veins::VeinsInetMobility::emitMobilityStateChangedSignal()' redeclared without dllimport attribute after being referenced with dll linkage
 void VeinsInetMobility::emitMobilityStateChangedSignal() {
      ^~~~~~~~~~~~~~~~~
Creating shared library: ../out/gcc-debug/src/libveins_inet.dll
../out/gcc-debug/src/veins_inet/VeinsInetMobility.o: In function `Veins::VeinsInetMobility::VeinsInetMobility()':
C:\omnetpp-5.1.1\samples\veins_inet\src/veins_inet/VeinsInetMobility.cc:47: undefined reference to `__imp__ZTVN5Veins17VeinsInetMobilityE'
C:\omnetpp-5.1.1\samples\veins_inet\src/veins_inet/VeinsInetMobility.cc:47: undefined reference to `__imp__ZTVN5Veins17VeinsInetMobilityE'
../out/gcc-debug/src/veins_inet/VeinsInetMobility.o: In function `Veins::VeinsInetMobility::~VeinsInetMobility()':
C:\omnetpp-5.1.1\samples\veins_inet\src/./veins_inet/VeinsInetMobility.h:37: undefined reference to `__imp__ZTVN5Veins17VeinsInetMobilityE'
C:\omnetpp-5.1.1\samples\veins_inet\src/./veins_inet/VeinsInetMobility.h:37: undefined reference to `__imp__ZTVN5Veins17VeinsInetMobilityE'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:89: ../out/gcc-debug/src/libveins_inet.dll] Error 1
make[1]: Leaving directory '/c/omnetpp-5.1.1/samples/veins_inet/src'
make: *** [Makefile:12: all] Error 2

我尝试使用gcc-release而不是gcc-debug,但问题仍然存在。有什么帮助吗?谢谢。

Max,

2 个答案:

答案 0 :(得分:0)

正如你所说,它看起来确实像Windows问题。今天,当我第一次在Windows下构建veins_inet时,我得到了完全相同的错误。上个月,我被迫多次重新安装我的Linux(Ubuntu 16.04 64位)工作站并且从未遇到过同样的问题 - 它编译完美无缺。

答案 1 :(得分:0)

如果存在INET_API xx类:public,则可以检查VeinsInetMobility.h。在某些omnet Windows版本中,“ INET_API”可能引起“没有dllimport属性”警告和“未定义引用”错误。您可以删除“ INET_API”以查看是否可以。只是建议。