13

I am creating a project using Xcode using OpenCV library. I get an compiling error saying

Not a Doxygen trailing comment

in core.hpp and lots of other sources contained in the opencv framework. (Editor: I got my opencv framework from somewhere in the internet and needed to bind it to my project).

enter image description here

How do I save myself?

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
sophchoe
  • 141
  • 1
  • 3

4 Answers4

28

You can go to Build Settings and search for Documentation Comments and set as No. Doxygen is just a format, you can skip that for code you are not the owner.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
David Bemerguy
  • 1,334
  • 11
  • 15
  • 1
    Thanks! That will give you a bounty :-) Btw, "can", not "can't" – qwerty_so Jan 06 '17 at 21:09
  • 2
    Disabling the warning locally for code you don't own/can't get changed is 100% the right answer for the OP's situation. But it's a valid warning because trailing Doxygen comments commence e.g. //!< or ///<, not //<. People who end up here based on a web search for this warning could be tempted to think this answer gives them a free pass to ignore it for code they do own, instead of reading [the relevant bit of the Doxygen documentation](http://www.doxygen.nl/manual/docblocks.html#cppblock) and fixing the code. – egyik Feb 06 '20 at 06:30
  • Not everyone uses doxygen. A `//` is a legit comment. – spartygw Feb 25 '21 at 20:43
4

As a temp solution:

  1. Get rid of most of the warnings by clicking the yellow triangle and pressing return which will make some auto-correction.

enter image description here

  1. For the single one with an exclamation mark in the triangle delete some of the comment. enter image description here

This will basically just change some of the comments in the opencv sources. Since mine is a local copy and not git clone that's fine. I guess that basically the opencv guys need to get that fixed. However, it would be nice to know some compiler option in Swift to turn those warnings off.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
3

This solved it for me, suppressing the warnings only in the third party library headers. Just wrap the problematic header #includes with these pragmas:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#pragma clang diagnostic pop

You can substitute or add other warning flags to be ignored. This is a combination of a hint from Konchog and Vladimir Grigorov’s super helpful answer here.

Craig Reynolds
  • 675
  • 7
  • 16
2

It's a warning from Doxygen because you have put something that's nearly a specifier for a trailing comment.

It's the left angle bracket that's the problem, with only two slashes.

///< this is a valid Doxygen trailing comment

/**< this is also a valid trailing comment*/

Andy Dent
  • 17,578
  • 6
  • 88
  • 115