Error compiling project with Qtcreator

Hello,

I created a new project using Qtcreator template and i can’t compile it.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_QTCaptureDevice", referenced from:
      objc-class-ref in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_CLASS_$_QTCaptureDeviceInput", referenced from:
      objc-class-ref in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_CLASS_$_QTCaptureMovieFileOutput", referenced from:
      objc-class-ref in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_CLASS_$_QTCaptureSession", referenced from:
      objc-class-ref in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_CLASS_$_QTCaptureVideoPreviewOutput", referenced from:
      _OBJC_CLASS_$_QTKitVideoGrabber in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_CLASS_$_QTCompressionOptions", referenced from:
      objc-class-ref in libopenFrameworks.a(ofQTKitGrabber.o)
  "_OBJC_METACLASS_$_QTCaptureVideoPreviewOutput", referenced from:
      _OBJC_METACLASS_$_QTKitVideoGrabber in libopenFrameworks.a(ofQTKitGrabber.o)
  "_QTMediaTypeMuxed", referenced from:
      +[QTKitVideoGrabber listVideoDevices] in libopenFrameworks.a(ofQTKitGrabber.o)
      -[QTKitVideoGrabber setVideoDeviceID:] in libopenFrameworks.a(ofQTKitGrabber.o)
      ofQTKitGrabber::setVideoDeviceID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libopenFrameworks.a(ofQTKitGrabber.o)
  "_QTMediaTypeSound", referenced from:
      +[QTKitVideoGrabber listAudioDevices] in libopenFrameworks.a(ofQTKitGrabber.o)
      -[QTKitVideoGrabber setAudioDeviceID:] in libopenFrameworks.a(ofQTKitGrabber.o)
      +[QTKitVideoGrabber listAudioCodecs] in libopenFrameworks.a(ofQTKitGrabber.o)
      -[QTKitVideoGrabber setAudioCodec:] in libopenFrameworks.a(ofQTKitGrabber.o)
      ofQTKitGrabber::setAudioDeviceID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libopenFrameworks.a(ofQTKitGrabber.o)
  "_QTMediaTypeVideo", referenced from:
      +[QTKitVideoGrabber listVideoDevices] in libopenFrameworks.a(ofQTKitGrabber.o)
      -[QTKitVideoGrabber setVideoDeviceID:] in libopenFrameworks.a(ofQTKitGrabber.o)
      +[QTKitVideoGrabber listVideoCodecs] in libopenFrameworks.a(ofQTKitGrabber.o)
      -[QTKitVideoGrabber setVideoCodec:] in libopenFrameworks.a(ofQTKitGrabber.o)
      ofQTKitGrabber::setVideoDeviceID(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in libopenFrameworks.a(ofQTKitGrabber.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The project is really straight forward : i just added an ofVideoGrabber object and set it up in ofApp::setup()

Using OSX El Capitan with oF0.9.3 and Qtcreator 3.6.1

Everything works fine under XCode but i would like to switch to Qtcreator as i am working with both OSX and Linux.

thanks a lot

I remember to have had this error sometimes (which is not the case anymore)…

I think you have to open the .qbs file at the top of your project and seek the line
of.frameworks: []
and replace it with
of.frameworks: ['QtKit']

or something like that - Just a hint, I’m not sure if this line is the good one

hey !

this is precisely what fixes the issu :slight_smile:

thanks a lot for the tip !

@arturo is this documented somewhere ?

1 Like

no, this seems like a bug, probably went undetected cause not much people use qt creator in osx and you need to use the videograbber to trigger it. can you send a PR?

Qt Creator is a very cool Xcode alternative, I don’t know if I might face some issues in future but until now everything is fine. Just my 2 cents, but Qt Creator is far more friendly than Xcode, even if a little bit slower at compile time.

Compared to XCode one thing that slows things down is DSYM generation in debug mode (which if I understand well is only required for release mode), I tried to find a solution to use DWARF without DSYM, seeking into the various .qbs files but I ended nowhere…

I filed a bug report instead of PR as i don’t know if it is a permanent fix or if the QtKit must be added to the .qbs dynamically only in certain cases.

Issue : https://github.com/openframeworks/openFrameworks/issues/5173

I find myself quite comfortable with XCode but i like the idea i can work the same under OSX or Linux (or Windows) with Qtcreator. And the IDE seems quite nice, even if i am not skilled enough to measure all the subtleties of each one.