0

I wish to setup Affectiva SDK 4.0.0 for Linux and hence, have started working on example apps from https://github.com/Affectiva/cpp-sdk-samples

I have Ubunutu 16.04, OpenCV 2.4.11, Boost 1.63, cmake 3.8.1, pre-installed gcc 5.5.0 and manually installed gcc 5.4.0 (because I could not find a proper setup for gcc 5.4.1 as required).

When I try to run below command to compile the code from video-demo folder:

g++ video_analyse.cpp -o video_analyse -std=c++11 -I$HOME/affdex-sdk/include -L$HOME/affdex-sdk/lib -I$HOME/sdk-samples/common -l affdex-native -l boost_program_options `pkg-config opencv --cflags --libs`

The error points to below line of code:

shared_ptr<PlottingImageListener> listenPtr(new PlottingImageListener(csvFileStream, draw_display));

And receive error:

/tmp/ccWtKCG0.o: In function `PlottingImageListener::PlottingImageListener(std::basic_ofstream<char, std::char_traits<char> >&, bool)':
video_analyse.cpp:(.text._ZN21PlottingImageListenerC2ERSt14basic_ofstreamIcSt11char_traitsIcEEb[_ZN21PlottingImageListenerC5ERSt14basic_ofstreamIcSt11char_traitsIcEEb]+0x148): undefined reference to `Visualizer::Visualizer()'
collect2: error: ld returned 1 exit status

The exact same error is received with gcc 5.5.0 as well.

If I comment everything starting from that line of code, then the compilation happens successfully.

Please guide me on this. Either on how to install the exact version of gcc 5.4.1 as expected by the SDK dependency OR anything which I might be missing.

Mudra
  • 36
  • 8
  • I'd say the linker can't find a header file containing the definition for `Visualizer::Visualizer()`. – jackw11111 Mar 07 '19 at 13:12
  • what branch of that repo are you building with? – Andy Dennie Mar 07 '19 at 13:18
  • It is emotion-sdk branch. I followed the instructions provided in the README. – Mudra Mar 08 '19 at 05:45
  • @AndyDennie should I change the branch? – Mudra Mar 11 '19 at 13:15
  • No, I was just checking so I could be sure I was looking at the right code. It looks to me like you are only compiling the source file video_analyse.cpp (which I'm assuming is something you've created but is similar to video-demo.cpp in that repo). The linker is complaining that ther is no definition of the Visualizer constructor at link time. You need to add common/visualizer.cpp to the build command so that it gets compiled and is available at link time. – Andy Dennie Mar 11 '19 at 18:19
  • Yes, video_analyse.cpp is exactly the same sa video-demo.cpp in the repo. When I encountered the error, I did not want to change the original file for debug purpose hence, created a copy. Moreover, I have included common folder while compiling through adding -I parameter `-I$HOME/sdk-samples/common`. I also tried copying everything to the same folder and faced the same error. – Mudra Mar 12 '19 at 05:03
  • Try recursively searching the project for the string `Visualizer::Visualizer()` to see which file the definition is located in. Something like `grep -r "Visualizer::Visualizer()" ~/cpp-sdk-samples`. – jackw11111 Mar 12 '19 at 10:26

0 Answers0