Ask Your Question
0

Compiling c++ code give an error "‘nameWindow’ was not declared in this scope"

asked 2015-03-27 10:41:37 -0600

namiqaliyev gravatar image

I have a cpp code like below.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, const char *argv[])
{
    Mat img(480,640,CV_8UC3,Scalar(255,0,0));
    if(img.empty())
    {
        cout<<"Picture can not load..."<<endl;
        return -1;
    }
    nameWindow("test",CV_WINDOW_AUTOSIZE);
    imshow("test",img);
    waitKey(0);
    destroyWindow("test");
    return 0;
}

When I try to compile this code like below

g++ resimac.cpp

it gives an error

error: ‘nameWindow’ was not declared in this scope
  nameWindow("test",CV_WINDOW_AUTOSIZE);
                                      ^

So what is the problem? How to solve it?

edit retag flag offensive close merge delete

Comments

3

it is: namedWindow() not nameWindow() !

berak gravatar imageberak ( 2015-03-27 10:49:27 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2019-09-29 11:18:06 -0600

kdupreez gravatar image

its namedWindow - you spelled the function wrong.

edit flag offensive delete link more

Comments

what's difference between your answer and @berak comment?

LBerger gravatar imageLBerger ( 2019-09-29 12:28:32 -0600 )edit

oh, i didnt see the comment, seems they are the same suggest.. i would have thought you would provide an answer as an answer, not a comment though...

kdupreez gravatar imagekdupreez ( 2019-09-29 14:27:40 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-27 10:41:37 -0600

Seen: 1,949 times

Last updated: Sep 29 '19