Problems occurred when I used sketches to learn code

Hello, I encountered the following problems when I used sketches to learn code in the ardupilot tutorial and input the code for drawing horizontal lines. How can I solve them? Thank you!

Steps being learned:
Running Examples in SITL

Certain sketches can also be run in SITL. For example to run the protocol decoder sketch:

cd $ARDUPILOT_HOME # the top-level of an ArduPilot repository
./waf configure --board sitl
$ ./waf build --target examples/INS_generic

To start the sketch, run it directly:

./build/sitl/examples/RCProtocolDecoder -M quad -C

My problem:
fgf19@xin /cygdrive/d
$ cd ardupilot/

fgf19@xin /cygdrive/d/ardupilot
$ ./waf configure --board sitl

Setting top to : /cygdrive/d/ardupilot
Setting out to : /cygdrive/d/ardupilot/build
Autoconfiguration : enabled
Setting board to : sitl
Checking for ‘g++’ (C++ compiler) : /usr/bin/g++
Checking for ‘gcc’ (C compiler) : /usr/bin/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
Checking for need to link with librt : not necessary
Checking for HAVE_CMATH_ISFINITE : yes
Checking for HAVE_CMATH_ISINF : yes
Checking for HAVE_CMATH_ISNAN : yes
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISINF_STD_NAMESPACE : yes
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE : yes
Checking for header endian.h : yes
Checking for header byteswap.h : yes
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 3.6.15
Checking for program ‘python’ : /usr/bin/python
Checking for python version >= 2.7.0 : 3.6.15
Source is git repository : yes
Update submodules : yes
Checking for program ‘git’ : /usr/bin/git
Checking for program ‘size’ : /usr/bin/size
Benchmarks : disabled
Unit tests : enabled
Checking for program ‘rsync’ : /usr/bin/rsync
‘configure’ finished successfully (6.952s)

fgf19@xin /cygdrive/d/ardupilot
$

fgf19@xin /cygdrive/d/ardupilot
$ ./waf build --target examples/INS_generic

Waf: Entering directory /cygdrive/d/ardupilot/build/sitl' [4/4] Creating build/sitl/ap_version.h [364/469] Compiling libraries/DataFlash/DFMessageWriter.cpp [469/469] Linking build/sitl/examples/INS_generic.exe /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/bin/ld: lib/libap.a(GCS_Common.cpp.0.o):GCS_Common.cpp:(.rdata$.refptr._ZN11GCS_MAVLINK18all_stream_entriesE[.refptr._ZN11GCS_MAVLINK18all_stream_entriesE]+0x0): undefined reference to GCS_MAVLINK::all_stream_entries’
/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/…/…/…/…/x86_64-pc-cygwin/bin/ld: lib/libap.a(GCS_Common.cpp.0.o):GCS_Common.cpp:(.rdata$.refptr._ZN11GCS_MAVLINK8var_infoE[.refptr._ZN11GCS_MAVLINK8var_infoE]+0x0): undefined reference to GCS_MAVLINK::var_info' /usr/lib/gcc/x86_64-pc-cygwin/7.4.0/../../../../x86_64-pc-cygwin/bin/ld: lib/libap.a(AP_FWVersion.cpp.0.o):AP_FWVersion.c:(.rdata$.refptr._ZN12AP_FWVersion5fwverE[.refptr._ZN12AP_FWVersion5fwverE]+0x0): undefined reference to AP_FWVersion::fwver’
collect2: error: ld returned 1 exit status

Waf: Leaving directory `/cygdrive/d/ardupilot/build/sitl’
Build failed
→ task in ‘examples/INS_generic’ failed (exit status 1):
{task 123145293590320: cxxprogram INS_generic.cpp.1.o → INS_generic.exe}
/usr/bin/g++ -Wl,–gc-sections -pthread libraries/AP_InertialSensor/examples/INS_generic/INS_generic.cpp.1.o -oexamples/INS_generic.exe -Wl,-Bstatic -Llib -lap -Wl,-Bdynamic -lm -lwinmm

I think these sketches are not supported anymore… maybe @amilcarlucas can bring some light on it.

Are you using master branch from git?
Have you done “git submodule update --init --recursive” ?
Have you installed all cygwin dependencies?

1 Like