c++

Error when using Decision Trees in OpenCV 3.0.0-rc1

扶醉桌前 提交于 2021-02-19 06:01:15
问题 I am doing some machine learning in OpenCV and i'm using Decision Trees . I am currently using OpenCV 3.0.0-rc1 . Whenever i attempt to train Decision Trees with my training data and labels, i get either terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc or Segmentation fault Depending on what i put into setMaxDepth(); if the number is larger than 22, it's bad_alloc, else it's seg fault. Here's my source code: //import data Mat trainData=imread("/home

cmake and tesseract, how to link using cmake

空扰寡人 提交于 2021-02-19 06:00:11
问题 I'm trying to build my application against tesseract, which i have installed through brew (working on mac os x). While i can compile my application without problem using g++ and pkg-config, i'm not sure how to do the same with cmake. I tried FIND_PACKAGE tesseract REQUIRED but it can't seem to find it. Does anyone have a sample CMakeLists.txt ? Appreciate the help. 回答1: It seems the only (or the easiest) way to use tesseract in your project with CMake is to download tesseract sources (from

How to read a UTF-16 text file in C++17

不打扰是莪最后的温柔 提交于 2021-02-19 05:57:06
问题 I am very new to C++. I want to read a UTF-16 text file in C++17 in Visual Studio 2019. I have tried several methods in the internet (including StackOverflow) but none of them worked, and some of them didn't compile (I think they only support older compilers). I am trying to achieve this without using any 3rd party libraries. This reads a text file, but it has some weird characters and spaces between each letter. // open file for reading std::wifstream istrm(filename, std::ios::binary); if (

CMDIChildWnd look & feel on Windows-10

删除回忆录丶 提交于 2021-02-19 05:51:51
问题 I have an MDI application. It has been developed over the years. On Windows-7 everything looks native. When I start the application on windows-10, normal dialogs will have the windows-10 look & feel. But all child views still have the Windows-7 look & feel. I tried to change from CMDIChildWnd to CMDIChildWndEx but it made no difference to the window look & feel (except of another border style around the client rect). I do not want to change all child views to dock panes as it will change the

C++ using two incompatible libraries together, what are the options?

此生再无相见时 提交于 2021-02-19 05:47:09
问题 I wrote a program using the point cloud library (PCL). Now I want to use some of cgal's algorithms. I've managed to build a cgal class in isolation (all dependencies working etc.) but when I try and combine the two projects I get unresolved external symbol errors So, what are my options for building a cgal project and accessing it (somehow) from my PCL project? I'd be passing a simple vector to the cgal project so in theory none of the specialist libraries have to interact with each other at

create transparent image from png, winapi

*爱你&永不变心* 提交于 2021-02-19 05:45:12
问题 I created a simple form to test in winapi: I uploaded here: http://pastebin.com/7dNjE1Tb I would like to put a simple png file to my hwnd, for example this picture: http://www.ledavi-network.com/includes/images/bg_shadow_png.png I know I should use this: http://msdn.microsoft.com/en-us/library/windows/desktop/dd145141(v=vs.85).aspx but I am very new in winapi and I dont find any example how to use this TransparentBlt function. Someone could help me to create a very simple example? EDIT: But

Combining FORTRAN and C++, linking error

為{幸葍}努か 提交于 2021-02-19 05:44:05
问题 I should couple in linux one c++ code with old fortran code, where fortan is the main code. Im not expert in this area and I try to start with simple test, but still I cannot compile it. Maybe I'm stupid, but I cannot find a working example anywhere. I managed to compile fortran and c, when the linking can be done by ifort (need to use intel compiler later with the actual fortran code). But If I've understood right, with c++ , the linking must be done by c++ compiler ( g++ ). So what do I do

What is the reason why clang and gcc do not implement std::hardware_{constructive,destructive}_interference_size?

旧时模样 提交于 2021-02-19 05:42:13
问题 I know the answer could be that they did not prioritize it, but it really feels like intentional omission, they already have plenty of C++20 core language/library features and this C++17 feature is still not implemented. In fact according to this table it is the only C++17 library feature that both clang and gcc did not implement. 来源: https://stackoverflow.com/questions/62025586/what-is-the-reason-why-clang-and-gcc-do-not-implement-stdhardware-constructiv

What is the reason why clang and gcc do not implement std::hardware_{constructive,destructive}_interference_size?

梦想的初衷 提交于 2021-02-19 05:42:06
问题 I know the answer could be that they did not prioritize it, but it really feels like intentional omission, they already have plenty of C++20 core language/library features and this C++17 feature is still not implemented. In fact according to this table it is the only C++17 library feature that both clang and gcc did not implement. 来源: https://stackoverflow.com/questions/62025586/what-is-the-reason-why-clang-and-gcc-do-not-implement-stdhardware-constructiv

Where does unordered_map<K, V>::iterator come from?

ぐ巨炮叔叔 提交于 2021-02-19 05:40:07
问题 When I'm using a std::unordered_map<K, V> I know that the iterator to each key-value pair is of type std::unordered_map<K, V>::iterator . I also know that the iterator itself points to a pair<const K, V> . However, the only reason I know the iterator points to a pair is from looking at example code. Where is this behavior defined? For example, if I go to the documentation at cppreference.com, I don't see where this behavior is explained. It only says that the member iterator is defined as a