# Compilation errors (OpenCV/QT)

**URL:** <https://forum.opencv.org/t/compilation-errors-opencv-qt/9310>\
**Category:** Uncategorized\
**Tags:** qt, build\
**Created:** [June 27, 2022, 8:36pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310 "2022-06-27T20:36:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jNc](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jNc](https://forum.opencv.org/u/jNc)\
**Post date:** [June 27, 2022, 8:36pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310/1 "2022-06-27T20:36:46Z")

</div>

Just reinstalled QT and compiled all libs, but could not compile previous working version:  
Initializing:

```auto
std::vector<std::vector<cv::Point> > test {{ {	52	,	2	}	, {	51	,	3	};

Errors:

C:\Users\66820\Documents\capture\main.cpp:16: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
 std::vector<std::vector<cv::Point> > test {{ { 52 , 2 } , { 51 , 3 } ,{ 50 , 3 } , { 49 , 3 } ,{ 48 , 3 } ,{ 47 , 3 } ,{ 46 , 3 } ,{ 45 , 3 } ,{ 44 , 3 } ,{ 43 , 3 } ,{ 42 , 3 } ,{ 41 , 3 } ,{ 40 , 4 } ,{ 39 , 4 } ,{ 38 , 4 } ,{ 37 , 4 } ,{ 36 , 4 } ,{ 35 , 4 } ,{ 34 , 4 } ,{ 33 , 4 } ,{ 32 , 5 } ,{ 31 , 5 } ,{ 30 , 6 } ,{ 29 , 6 } ,{ 28 , 6 } ,{ 27 , 7 } ,{ 26 , 7 } ,{ 25 , 7 } ,{ 24 , 8 }}};
------------
In c++98 must be initialized by constructor, not by '{...}'
how to fix these?

C:\Users\66820\Documents\capture\main.cpp:16: error: no matching function for call to 'std::vector<std::vector<cv::Point_<int> > >::vector(<brace-enclosed initializer list>)'

```

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 27, 2022, 8:38pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310/2 "2022-06-27T20:38:20Z")

</div>

> [@jNc](#):
>
> Just reinstalled QT

why do you think, there’s any connection to the error ?  
what about _reading_ the error msg:

```
extended initializer lists only available with -std=c++11 or -std=gnu++11

```

meaning, you need to pass one of those flags to your compiler, to make your code work.

also, just saying – qt is a (quite popular) gui library, just dont assume, the IDE / compiler toolchain it comes with is good at building _other things_ …

---

<div class="post-metadata">

**Author:** ![jNc](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jNc](https://forum.opencv.org/u/jNc)\
**Post date:** [June 27, 2022, 9:27pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310/3 "2022-06-27T21:27:14Z")

</div>

I think it might be related to gcc version or smth…  
But as I told above, this code worked perfectly in previous compiler build.  
What I’m I supposed to do to fix those?

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [June 27, 2022, 9:41pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310/4 "2022-06-27T21:41:14Z")

</div>

> [@jNc](#):
>
> What I’m I supposed to do to fix those?

add `-std=c++11` to your compiler cmdline, like the error states

---

<div class="post-metadata">

**Author:** ![jNc](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jNc](https://forum.opencv.org/u/jNc)\
**Post date:** [June 27, 2022, 10:04pm UTC](https://forum.opencv.org/t/compilation-errors-opencv-qt/9310/5 "2022-06-27T22:04:21Z")

</div>

thanks! Light google search have not helped :D.  
Any thoughts how to amend pro file in QT accordingly?  
Berak, big thanks in advance
