How add string variable to project? file Plane.h
I tried
#include <string
>
std::string str;
but error appear.
Can I add c++ string to project?
Help please. Thanks!
If you do not tell the exact error message, how do you expect us to help? Telepathy??
In file included from ā¦/ā¦/ArduPlane/mode_loiter.cpp:2:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/RC_Channel.cpp:1:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/mode_guided.cpp:2:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/altitude.cpp:16:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/tiltrotor.cpp:1:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/mode_thermal.cpp:2:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/avoidance_adsb.cpp:3:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
In file included from ā¦/ā¦/ArduPlane/mode_acro.cpp:2:0:
ā¦/ā¦/ArduPlane/Plane.h:178:2: error: āstringā does not name a type
string tail = āasddā;
^~~~~~
compilation terminated due to -Wfatal-errors.
Waf: Leaving directory `/home/andre/ardupilot/build/CUAV-X7ā
Build failed
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291275848: cxx mode_loiter.cpp -> mode_loiter.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145289677736: cxx RC_Channel.cpp -> RC_Channel.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291275288: cxx mode_guided.cpp -> mode_guided.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145289677848: cxx altitude.cpp -> altitude.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145288751144: cxx tiltrotor.cpp -> tiltrotor.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145288749464: cxx mode_thermal.cpp -> mode_thermal.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291273720: cxx avoidance_adsb.cpp -> avoidance_adsb.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291274728: cxx mode_acro.cpp -> mode_acro.cpp.34.o}
(run with -v to display more information)
simple :
std::string test = āplopā;
But it doesnāt work. I tried the same. I donāt unferstand why Ardupilot doesnāt work with string
In file included from ā¦/ā¦/ArduPlane/Attitude.cpp:1:0:
ā¦/ā¦/ArduPlane/Plane.h:179:7: error: āstringā in namespace āstdā does not name a type
std::string test = āplopā;
^~~~~~
compilation terminated due to -Wfatal-errors.
Waf: Leaving directory `/home/andre/ardupilot/build/CUAV-X7ā
Build failed
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291171992: cxx mode_loiter.cpp -> mode_loiter.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291186808: cxx servos.cpp -> servos.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145293299608: cxx avoidance_adsb.cpp -> avoidance_adsb.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145293299160: cxx Plane.cpp -> Plane.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291187256: cxx takeoff.cpp -> takeoff.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145293298712: cxx GCS_Mavlink.cpp -> GCS_Mavlink.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145291187144: cxx tailsitter.cpp -> tailsitter.cpp.34.o}
(run with -v to display more information)
-> task in ābin/arduplaneā failed (exit status 1):
{task 123145293298040: cxx Attitude.cpp -> Attitude.cpp.34.o}
(run with -v to display more information)
I need to use some strings variables. How to use strings in Ardupilot correctly?
I tried #include <string>
, std::string
, string.h
, cstring
, but donāt work. donāt build. Thanks
Iāve had been struggling with the same problem. Your comment helped me a lot. To whom it might concern:
For efficiency reasons, ArduPilot doesnāt use the C standard library (std::
). We also prefer to use functions which are consistent across platforms to ease support (not using 64-bit maths on platforms that support it is useful, for example).
This means no std::vector
, no std::string
and no std::unordered_map
, for example.