Compilation errror: XY was no declared in this scope

asked 2014-10-03 21:23:16 -0500

maxdoom gravatar image

updated 2014-10-04 00:18:00 -0500

I there,

i was trying to follow this tutorial: and tried to compile the sample code given here: and get the following error:

[email protected]:~/Workspace/OpenCV/scan images$ g++ `pkg-config --cflags opencv` how_to_scan_images.cpp `pkg-config --libs opencv` -o test
how_to_scan_images.cpp: In function ‘int main(int, char**)’:
how_to_scan_images.cpp:38:29: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
how_to_scan_images.cpp:40:29: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope

I was using the following compilation command

g++ `pkg-config --cflags opencv` how_to_scan_images.cpp `pkg-config --libs opencv` -o test

The Code itself is correct, so why do I still get this error. Edit: I'm using Debian Linux and OpenCV 3.

Thanks in advance!

edit retag flag offensive close merge delete



ah, another tutorial bug.


(btw, for 3.0, use: [still wrong there, too] )

berak gravatar imageberak ( 2014-10-04 01:33:07 -0500 )edit

Nice you fixed it, thanks a lot. Btw thanks for the link, very useful stuff. Anyhow I'am new to OpenCV so I'll need to work through the tutorials.

maxdoom gravatar imagemaxdoom ( 2014-10-04 01:51:20 -0500 )edit

@berak is this fix included in your PR?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-06 06:40:10 -0500 )edit

no ;) those were only the rst files.

( i didn't dare to change more in one go (49 files already, hey),

what's your opinion, - have another run at it, change all the tutorial code too ? (so it's in sync) - or do a seperate pr for this ?)

berak gravatar imageberak ( 2014-10-06 07:01:43 -0500 )edit

btw, above link to how_to_scan_images.cpp is from 2.4, it's fixed in 3.0

berak gravatar imageberak ( 2014-10-06 07:14:01 -0500 )edit

I would do a seperate PR for that. But it needs to be done ... because there are still enough wrong tutorials out there. Already tried to fix some of them in the past.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-06 07:16:02 -0500 )edit

yep, thanks, what i'm thinking, too. (actually, there's only a few CV_CAP_* things left in the user guide code and a few CV_BGR2* in the winrt section.

(but right. i'll send out a 2nd pr later the day ..)

berak gravatar imageberak ( 2014-10-06 07:19:19 -0500 )edit