Reputation: 141
I want to use TraCIMobility.h
from Veins to change some SUMO variables for visualization.
I receive an error, when building my project. TraCIMobility.h
can't find BaseMobility.h
, which is also part of Veins. Are there some problems inside the Veins project? I built it one more time, but it can't find its own modules. I added Veins to my project with Project
->Properties
->Project References
.
This is the error:
10:12:16 **** Incremental Build of configuration gcc-debug for project CloudBasedCSW ****
make MODE=debug CONFIGNAME=gcc-debug all
cd src && make
make[1]: Entering directory `/c/work/Cloud_Curve_Speed_Warning/trunk/src/CloudBasedCSW/src'
visualization/Visualization.cc
In file included from ./visualization/Visualization.h:19:0,
from visualization/Visualization.cc:16:
C:/Tools/veins/src/veins-3.0/src/modules/mobility/traci /TraCIMobility.h:31:26: fatal error: BaseMobility.h: No such file or directory
make[1]: Leaving directory `/c/work/Cloud_Curve_Speed_Warning/trunk/src/CloudBasedCSW/src'
compilation terminated.
make[1]: *** [../out/gcc-debug/src/visualization/Visualization.o] Error 1
make: *** [all] Error 2
10:12:17 Build Finished (took 726ms)
This is the header, which includes TraCiMobility.h
#ifndef VISUALIZATION_H_
#define VISUALIZATION_H_
#include <omnetpp.h>
#include "modules/mobility/traci/TraCIMobility.h"
class Visualization: public cSimpleModule{
public:
Visualization();
virtual ~Visualization();
void initialize();
void handleMessage(cMessage *msg);
void setIce(std::string laneId);
void removeIce(std::string laneId);
};
#endif /* VISUALIZATION_H_ */
Upvotes: 1
Views: 1032
Reputation: 6943
You didn't say which Veins version you are using, so I am assuming the newest, Veins 4a2. Here, you will need to specify the include path like so
#include "veins/modules/mobility/traci/TraCIMobility.h"
To clarify: the --meta:auto-include-path
option to opp_makemake will always generate a -I
include path that includes all of the missing components to make the include work (that is, writing as little as #include "traci/TraCIMobility.h"
would yield a compiler flag of -I..../veins/src/veins/modules/mobility
), but without adding a -I
include path to the root of Veins, none of the includes within work. By specifying the full path to the file (relative to the source root of Veins), you are forcing opp_makemake to generate a -I
include path of -I..../veins/src
, which is what is needed to build Veins.
Upvotes: 1