Hello fellow community,
I am really new to stackoverflow although I often find great and inspiring answers, when I am really stucked. This one I wasn't able to find anything, so I post it.
Short introduction: I teached myself c++ in 2010 and then changed to VB, C# and Java. I completely missed this whole managed system and was really confused, when things didn't work like they used to.
The problem: My application is using openCV and I already managed to have working builds. At the moment I try to show a picture in a windows forms picturbox
and at the same time manipulating it with openCV.
include structure (general):
main.cpp includes main.h
main.h includes openCV string msclr/marshal_cppstd.h form1, form2, form3
the probelm ocurrs in form3.h. Basic structure of form3.h:
#pragma once
cv::Mat srcImg;
HBITMAP get_srcImg()
{
HBITMAP b = CreateBitmap(srcImg.cols, srcImg.rows, 1, 32, srcImg.data);
return b;
}
namespace ownProject{//this is all automatically generated by the designer
class form {...}
I get:
Severity Code Description Project File Line Suppression State Error LNK2019 unresolved external symbol "extern "C" struct HBITMAP__ * cdecl CreateBitmap(int,int,unsigned int,unsigned int,void const *)" (?CreateBitmap@@$$J0YAPEAUHBITMAP@@HHIIPEBX@Z) referenced in function "struct HBITMAP__ * cdecl get_srcImg(void)" (?get_srcImg@@$$FYAPEAUHBITMAP@@XZ) Path_recognition
And I don't know how to solve it. If I delete the createBitmap
function, everything is working properly. The problem is I need to convert the picture between the pictureBox
and openCV-functions. I had unresolved externals before and fixed it by adjusting the include hierarchy and deleting all cpp-files except main.cpp.
I hope you can help me. Thank you.