Detectnet-video linker error

Hi there,

I use this code: https://github.com/dusty-nv/jetson-inference/blob/master/examples/detectnet/detectnet.cpp
I copied the code to CodeLite IDE and I configured the compiler and the linker.
I tried to build and run the project, but I got some errors and warnings as well:

/bin/sh -c ‘/usr/bin/make -j4 -e -f Makefile’
----------Building project:[ detectnet-video - Debug ]----------
make[1]: Entering directory ‘/home/nvidia/Documents/CodeLite/detectnet/detectnet-video’
/usr/bin/g++ -c “/home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp” -g -O0 -std=c++14 -Wall -o ./Debug/main.cpp.o -I. -I. -I/usr/local/include -I/usr/local/include/jetson-inference -I/usr/local/include/jetson-utils -I/usr/local/cuda-10.2/targets/aarch64-linux/include
In file included from /usr/local/include/jetson-utils/videoOptions.h:29:0,
from /usr/local/include/jetson-utils/videoSource.h:27,
from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:1:
/usr/local/include/jetson-utils/URI.h:63:60: warning: “/*” within comment [-Wcomment]

  •    contain wildcard characters, for example `"images/*.jpg"` - however when using wildcards
    

In file included from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:1:0:
/usr/local/include/jetson-utils/videoSource.h:102:60: warning: “/*” within comment [-Wcomment]

  •    contain wildcard characters, for example `"images/*.jpg"` - however when using wildcards
    

In file included from /usr/local/include/jetson-utils/imageFormat.h:28:0,
from /usr/local/include/jetson-utils/videoOptions.h:26,
from /usr/local/include/jetson-utils/videoSource.h:27,
from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:1:
/usr/local/include/jetson-utils/cudaUtility.h: In function ‘cudaError_t cudaCheckError(cudaError_t, const char*, const char*, int)’:
/usr/local/include/jetson-utils/cudaUtility.h:91:4: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
if( retval == cudaSuccess )
^
In file included from /usr/local/include/jetson-utils/imageFormat.h:231:0,
from /usr/local/include/jetson-utils/videoOptions.h:26,
from /usr/local/include/jetson-utils/videoSource.h:27,
from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:1:
/usr/local/include/jetson-utils/imageFormat.inl: In function ‘const char* imageFormatToStr(imageFormat)’:
/usr/local/include/jetson-utils/imageFormat.inl:33:8: warning: enumeration value ‘IMAGE_COUNT’ not handled in switch [-Wswitch]
switch(format)
^
/usr/local/include/jetson-utils/imageFormat.inl: In function ‘imageBaseType imageFormatBaseType(imageFormat)’:
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_RGB8’ not handled in switch [-Wswitch]
switch(format)
^
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_RGBA8’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BGR8’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BGRA8’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_YUYV’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_YUY2’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_YVYU’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_UYVY’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_I420’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_YV12’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_NV12’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BAYER_BGGR’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BAYER_GBRG’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BAYER_GRBG’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_BAYER_RGGB’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_GRAY8’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_COUNT’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl:142:8: warning: enumeration value ‘IMAGE_UNKNOWN’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl: In function ‘size_t imageFormatChannels(imageFormat)’:
/usr/local/include/jetson-utils/imageFormat.inl:158:8: warning: enumeration value ‘IMAGE_COUNT’ not handled in switch [-Wswitch]
switch(format)
^
/usr/local/include/jetson-utils/imageFormat.inl:158:8: warning: enumeration value ‘IMAGE_UNKNOWN’ not handled in switch [-Wswitch]
/usr/local/include/jetson-utils/imageFormat.inl: In function ‘size_t imageFormatDepth(imageFormat)’:
/usr/local/include/jetson-utils/imageFormat.inl:189:8: warning: enumeration value ‘IMAGE_COUNT’ not handled in switch [-Wswitch]
switch(format)
^
/usr/local/include/jetson-utils/imageFormat.inl:189:8: warning: enumeration value ‘IMAGE_UNKNOWN’ not handled in switch [-Wswitch]
In file included from /usr/local/include/jetson-utils/imageFormat.h:231:0,
from /usr/local/include/jetson-utils/videoOptions.h:26,
from /usr/local/include/jetson-utils/videoSource.h:27,
from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:1:
/usr/local/include/jetson-utils/imageFormat.inl: In function ‘imageFormat imageFormatFromType()’:
/usr/local/include/jetson-utils/imageFormat.inl:235:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
In file included from /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:2:0:
/usr/local/include/jetson-utils/videoOutput.h: In member function ‘uint32_t videoOutput::GetNumOutputs(videoOutput*) const’:
/usr/local/include/jetson-utils/videoOutput.h:247:80: warning: no return statement in function returning non-void [-Wreturn-type]
inline uint32_t GetNumOutputs( videoOutput* output ) const { mOutputs.size(); }
^
/usr/bin/g++ -o ./Debug/detectnet-video @“detectnet-video.txt” -L. -L/usr/local/lib -L/usr/local/cuda-10.2/targets/aarch64-linux/lib -lopencv_calib3d -lopencv_core -lopencv_dnn -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_video -lopencv_videoio -lopencv_videostab -lcudart -lcufft -lcufftw -lcuinj64 -lcupti -lcurand -lcusolver -lcusparse -lnppc -lnppial -lnppicc -lnppicom -lnppidei -lnppif -lnppig -lnppim -lnppist -lnppisu -lnppitc -lnpps -lnvgraph -lnvperf_host -lnvperf_target -lnvrtc
./Debug/main.cpp.o: In function main': /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:50: undefined reference to commandLine::commandLine(int, char**, char const*)’
/home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:52: undefined reference to commandLine::GetFlag(char const*, bool) const' /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:66: undefined reference to videoOptions::videoOptions()’
/home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:66: undefined reference to videoSource::Create(char const*, videoOptions const&)' /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:78: undefined reference to videoOutput::Create(commandLine const&, int)’
/home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:87: undefined reference to detectNet::Create(commandLine const&)' /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:96: undefined reference to commandLine::GetString(char const*, char const*, bool) const’
/home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:96: undefined reference to detectNet::OverlayFlagsFromStr(char const*)' /home/nvidia/Documents/CodeLite/detectnet/detectnet-video/main.cpp:136: undefined reference to precisionTypeToStr(precisionType)’
./Debug/main.cpp.o: In function Log::GetLevel()': /usr/local/include/jetson-utils/logging.h:76: undefined reference to Log::mLevel’
/usr/local/include/jetson-utils/logging.h:76: undefined reference to Log::mLevel' ./Debug/main.cpp.o: In function Log::GetFile()’:
/usr/local/include/jetson-utils/logging.h:86: undefined reference to Log::mFile' /usr/local/include/jetson-utils/logging.h:86: undefined reference to Log::mFile’
./Debug/main.cpp.o: In function tensorNet::PrintProfilerTimes()': /usr/local/include/jetson-inference/tensorNet.h:517: undefined reference to profilerQueryToStr(profilerQuery)’
./Debug/main.cpp.o: In function int detectNet::Detect<uchar3>(uchar3*, unsigned int, unsigned int, detectNet::Detection**, unsigned int)': /usr/local/include/jetson-inference/detectNet.h:316: undefined reference to detectNet::Detect(void*, unsigned int, unsigned int, imageFormat, detectNet::Detection**, unsigned int)’
collect2: error: ld returned 1 exit status
detectnet-video.mk:76: recipe for target ‘Debug/detectnet-video’ failed
make[1]: *** [Debug/detectnet-video] Error 1
make[1]: Leaving directory ‘/home/nvidia/Documents/CodeLite/detectnet/detectnet-video’
Makefile:4: recipe for target ‘All’ failed
make: *** [All] Error 2
====16 errors, 34 warnings====

This procedure worked me before, but I flashed my Jetson TX2 to JetPack4.4, so I should configure everything again. Please help me solve the problem!

Thank you in advance!

It appears that the example executables are not being setup to link against the jetson-inference and jetson-utils library.

Is this using cmake to generate the makefile? I would recommend having your IDE use the build tools supported by the GitHub project as opposed to your own. The supported build is using cmake and make.

Thank you for response!
I added jetson-inference and jetson-utils libraries to linker libraries and it works fine.