Ask Your Question
0

What is the purpose of _c.h files?

asked 2013-06-03 02:24:08 -0600

mtngardener gravatar image

I am running into issues with my OpenCV install. Trying to run various tutorials I am getting errors during compilation where constants aren't defined. When I search for the definitions I find that they are in files that end with _c.h. These files don't seem to be included anywhere. I don't see how to build without including them, but for some of them, when I add them it just makes the problems worse (for example, including highgui_c.h fixes a problem, but including core_c.h causes a chain of additional requirements that seems insoluble).

What is the idea behind _c.h files? When should they be included? How should they be included?

I am running with VC2012 on Windows 7. I am able to build and run the example code. I am currently trying to get the Camera Calibration tutorial code to run:

http://docs.opencv.org/doc/tutorials/calib3d/camera_calibration/camera_calibration.html#source-code

edit retag flag offensive close merge delete

Comments

btw, please add the opencv version to your post

berak gravatar imageberak ( 2013-06-03 03:56:48 -0600 )edit

It is version 2.4.9, I'd guess, since my lib files end with "249.lib".

mtngardener gravatar imagemtngardener ( 2013-06-05 00:03:43 -0600 )edit

oh, jikes, that's quite a different setup

berak gravatar imageberak ( 2013-06-05 00:55:55 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-06-03 03:55:49 -0600

berak gravatar image

updated 2013-06-03 04:01:27 -0600

usually they contain the old c-api functionality.

you should never need to include them directly

to access the c-api, you'd go like:

#include <opencv/highgui.h>

for the c++ (2.x) api:

#include <opencv2/highgui/highgui.hpp>

don't resolve to hacking, you won't get far that way.

there must be something wrong in your vcproj file, or the install.

there's 2 ways to get the headers right:

  • easy(using the prebuilt stuff:

    point your "Additional Include Dirs" at opencv/build/include

    (it should just work , if that folder contains all the nessecary headers).

    note that if you build your own libs, cmake might install the headers in a "build/install/include" folder, check with cmake-gui, where things go!

  • hard(but safe):

    point your "Additional Include Dirs" at opencv/include, additionally for each module, add it's module path, like opencv/modules/highgui/include opencv/modules/core/include ,...

    more work, but this way, you don't depend on install things. (that's what cmake does, when you ask it to generate your own project depending on opencv)

edit flag offensive delete link more

Comments

So I should be pointing my VS2012 project's "Additional Include Dirs" to "install/include/opencv2"? If I do that, then do I need any of the #include "opencv2/foo" statements?

mtngardener gravatar imagemtngardener ( 2013-06-05 00:12:48 -0600 )edit

Question Tools

Stats

Asked: 2013-06-03 02:24:08 -0600

Seen: 342 times

Last updated: Jun 03 '13