Error building the Blink example on visual studio

Hello everyone,

I’m trying to run the blinky example from this video using visual studio:

However I get the following output:

Starting Torizon build...
SDK Container needs to be updated...
Starting SDK container...
Setting connection info...
Torizon setup completed.
1>------ Build started: Project: Blink, Configuration: Debug_debian_arm64v8_bullseye x64 ------
1>Torizon Container Build
1>Building container ...
1>Step 1/13 : FROM --platform=linux/arm64 torizon/debian:2-bullseye
1>---> 1a47ad880f4f
1>Step 2/13 : EXPOSE 2222
1>---> Using cache
1>---> 6d0fe69954fa
1>Step 3/13 : ARG SSHUSERNAME=torizon
1>---> Using cache
1>---> 28109b327ca3
1>Step 4/13 : ARG SSHUSERNAME=torizon
1>---> Using cache
1>---> 3c07478b2e05
1>Step 5/13 : ENV DEBIAN_FRONTEND="noninteractive"
1>---> Using cache
1>---> 2d3fc760fa60
1>Step 6/13 : RUN touch /usr/bin/g++ &&     chmod +x /usr/bin/g++
1>---> Using cache
1>---> 14053692b0e1
1>Step 7/13 : RUN apt-get -q -y update     && apt-get -q -y install     openssl     openssh-server     rsync     libc-dev     gdb     zip     && rm -rf /var/lib/apt/lists/*
1>---> Using cache
1>---> 2103909ba4dc
1>Step 8/13 : COPY id_rsa.pub /id_rsa.pub
1>---> Using cache
1>---> 710eacf499d4
1>Step 9/13 : RUN mkdir /var/run/sshd     && sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd     && if test $SSHUSERNAME != root ; then mkdir -p /home/$SSHUSERNAME/.ssh ; else mkdir -p /root/.ssh ; fi     && if test $SSHUSERNAME != root ; then cp /id_rsa.pub /home/$SSHUSERNAME/.ssh/authorized_keys ; else cp /id_rsa.pub /root/.ssh/authorized_keys ; fi     && echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config     && echo "Port 2222" >> /etc/ssh/sshd_config     && su -c "env" $SSHUSERNAME > /etc/environment
1>---> Using cache
1>---> 3c394357a2a2
1>Step 10/13 : RUN rm -r /etc/ssh/ssh*key     && dpkg-reconfigure openssh-server
1>---> Using cache
1>---> 8f1f24025e54
1>Step 11/13 : RUN if [ ! -z "libgpiod-dev" ]; then     apt-get -q -y update     && apt-get -q -y install libgpiod-dev     && rm -rf /var/lib/apt/lists/* ;     fi
1>---> Using cache
1>---> 2b84b678dbfa
1>Step 12/13 : RUN usermod -a -G gpio torizon
1>---> Using cache
1>---> f9f1b4b3e48e
1>Step 13/13 : CMD ["/usr/sbin/sshd", "-D"]
1>---> Using cache
1>---> c391701994c6
1>Successfully built c391701994c6
1>Successfully tagged blink_arm64v8-debian_bullseye_debug_b45e9d75-3bb0-4578-84dd-61cb1bd446ff:latest
1>Done
1>Validating sources
1>Copying sources remotely to '127.0.0.1'
1>Validating architecture
1>Validating architecture
1>Starting remote build
1>Compiling sources:
1>main.cpp
1>Linking objects
1>/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld : error : /home/build/Blink/obj/x64/Debug_debian_arm64v8_bullseye/main.o: in function `main':
1>C:\Users\AhmedMobarez\Desktop\DL02\Blink\main.cpp(13): error : undefined reference to `gpiod_chip_open_by_number'
1>/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld : error : /home/build/Blink/main.cpp:14: undefined reference to `gpiod_chip_get_line'
1>/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld : error : /home/build/Blink/main.cpp:15: undefined reference to `gpiod_line_request_output'
1>/usr/lib/gcc-cross/aarch64-linux-gnu/10/../../../../aarch64-linux-gnu/bin/ld : error : /home/build/Blink/main.cpp:20: undefined reference to `gpiod_line_set_value'
1>collect2 : error : ld returned 1 exit status
1>Done building project "Blink.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

and errors that some functions have undefined reference, even though I go to the function definitions normally in visual studio, I also add the include folder in the project configuration:

the following is my project configuration:

I am using an Apalis IMX8QM on an ixora V1.2, my host is running Windows, and I am using visual studio 2019 with the torizon extension
image

since the project is small, you also find the project folder attached here:
Blink.zip (607.7 KB)

Hello again,

I solved the issue by adding gpiod in the linker library dependencies

thank you