|
That error is telling you that the linker cannot find the implementations of the three functions named in the error messages.
See: LNK2001[^]
Are you calling functions that you haven't implemented? This error can happen if you include a header (.h) file without also having the implementation (.cpp) file as part of the project.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thanks buddy that was the error
|
|
|
|
|
You have most likely failed to include the library that contains these functions. Check your project settings.
|
|
|
|
|
how do i create multiple threads to fetch words from the input file and insert them into the dictionary in c.
|
|
|
|
|
|
CreateThread()
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
hello,
I'm a begginer with win32 api, and i try to make a SysListview32 (aka WC_listview) with draggable columns to modify it order with the mouse. To do this, i create it with the LVS_EX_HEADERDRAGDROP etended style, like this :
ListView = CreateWindowEx( LVS_EX_HEADERDRAGDROP, WC_LISTVIEW, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | LVS_REPORT, 0, 0, RectParent.right, RectParent.bottom, hwnd, NULL, hInstance, NULL );
The listview appears correctly with columns and items, but don't work when i try to move a column with mouse. Do i forget something ???
Thank you in advance !!
|
|
|
|
|
LVS_EX_HEADERDRAGDROP is a extended style, that is why should be setup not there, but using SetExtendedStyle method:
ListCtrl.SetExtendedStyle(LVS_EX_HEADERDRAGDROP);
I don't know Win32, but I am sure there is SetExtendedStyle Win32 function ...
|
|
|
|
|
I have a c++ class that contains the following:
template<class T> class Poly {
public:
Poly<T>(int order = 0)
{
this->order = order;
coeffs = new double[order+1];
for( int i = 0;i<=order; i++ )
coeffs[i] = 0;
}
Poly<T>( int order, T *coeffs);
Poly<T>( Poly &poly );
~Poly()
{
delete []coeffs;
}
// other member functions are not shown.
friend ostream &operator << ( ostream &out,
Poly<T> &poly );
private:
// data members not show.
};
This class is defined in a file called poly.h. In the file poly.cpp, I have the following function definition:
template<class T>
ostream & operator << ( ostream &out, Poly<T> &poly )
{
bool printedCoeff = false;
.
.
.
return out;
}
In a third file called test.cpp, I have:
double coeffs[] = { 3, 1, 2, 1 };
Poly<double> p1(3,coeffs), p2;
cout << p1 << endl;
I am using the Microsoft Visual Studio and I get a linker error because of the statement:
cout << p1 << endl;
I believe that my definition of the function overloading << is
not properly getting instantiated. How do I fix this?
Bob
|
|
|
|
|
|
I am trying to use GDI+ within my MFC dialog based application with multiple child dialogs. On one of the child dialogs, I am trying to draw an image from an array of 8 bit BYTE pixel data. Here is how my flow process is for this-
Variables declared in my child dialog's header file.
LONG DIBSecWidth;
LONG DIBSecHeight;
LONG BitsPerPixel;
LONG Stride;
BITMAPINFO* bmi;
BYTE* pDIBSectionBits;
HBITMAP hbm;
Graphics* imagedisp;
Bitmap* offscreenBitmap;
RECT m_imagedisp_rect;
BOOL m_BUpdate;
Then in my OnInitDialog() function, I do the following
DIBSecWidth = 512;
DIBSecHeight = 512;
BitsPerPixel = 8;
Stride = ((DIBSecWidth* BitsPerPixel + 31L) & (~31L)) / 8L;
bmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO) + UCHAR_MAX * sizeof(RGBQUAD)];
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = DIBSecWidth;
bmi->bmiHeader.biHeight = DIBSecHeight;
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = (WORD)BitsPerPixel;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
memcpy(bmi->bmiColors, summercmap, 256*sizeof(RGBQUAD));
hbm = ::CreateDIBSection(NULL, bmi, DIB_RGB_COLORS, (void**)&pDIBSectionBits, NULL, 0);
offscreenBitmap = new Bitmap(bmi, pDIBSectionBits);
ImageDisplay.GetClientRect(&m_imagedisp_rect);
imagedisp = new Graphics(ImageDisplay.GetDC()->GetSafeHdc());
m_BUpdate = true;
and in OnPaint() message handler I have the following
CPaintDC dc(this);
if (m_BUpdate)
{
BYTE *pCurRowPixel = (BYTE *)(pDIBSectionBits);
memcpy(pCurRowPixel, m_pImgBuffPrc, DIBSecWidth*DIBSecHeight);
imagedisp->DrawImage(offscreenBitmap, 0, 0, DIBSecWidth, DIBSecWidth);
m_BUpdate = false;
delete pCurRowPixel;
}
Whenever I run my application, it throws an error at imagedisplay->DrawImage function, if I comment it out it doesn't throw the error. I am sure there is something simple that I am missing here or the way I am trying to draw is not right, any ideas/suggestions?
thanks
PKNT
modified 21-Sep-15 13:49pm.
|
|
|
|
|
Quote: delete pCurRowPixel;
What's the purpose of the above line? It looks plain wrong, to me.
|
|
|
|
|
I saw that too. But it is guarded by m_BUpdate .
|
|
|
|
|
The crashing call too is guarded by m_BUpdate .
Anyway, it is wrong calling delete on the memory allocated via CreateDIBSection .
|
|
|
|
|
CPallini wrote: Anyway, it is wrong calling delete on the memory allocated via CreateDIBSection .
Which might be the reason for the exception because <code> _BLOCK_TYPE_IS_VALID is thrown when trying to delete memory that wasn't allocated using new .
|
|
|
|
|
Is there any possibility to catch shift + left key without mess up PreTranslateMessage ? I have tried this:
void CGridCtrlExt::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(VK_LEFT == nChar || VK_RIGHT == nChar)
TRACE1(">>>%d", nChar);
CGridCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
I see TRACE message ... but when I wrote:
void CGridCtrlExt::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if((VK_LEFT == nChar || VK_RIGHT == nChar) && GetKeyState(VK_SHIFT) < 0)
TRACE1(">>>%d", nChar);
CGridCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}
I saw nothing ... can you help me out, please ? Thank you.
|
|
|
|
|
It should work that way. But it will not work if those key combinations are "eaten" by an existing pre-translation. You may test that by using the first version with an extended trace:
TRACE1(">>>%d, state %x", nChar, GetKeyState(VK_SHIFT));
If the above is not called with shift key down, it is probably "eaten". Then you must use PreTranslateMessage or try to disable the existing translation.
|
|
|
|
|
I was just made the same test:
TRACE("%d|%d\n", IsSHIFTpressed(), nChar);
but no, with shift key pressed, the keydown handler seem not calling ... I have to see what happen above this class. Thank you, and I'll come back with feedback.
|
|
|
|
|
Strange ... I have checked if parent of CGridCtrlExt (CGridCtrl ), has PreTranslateMessage , but no, has not ... more over, I override CGridCtrlExt::OnChar , CGridCtrlExt::OnSysChar , CGridCtrlExt::OnSysKeyDown , none of them tell me when I press the shift key ... weird ... I don't know where to search the issue ...
|
|
|
|
|
I don't know which CGridCtrl you are using. The keys may be also catched by an underlying Windows control so that you don't see the translator source.
If there is some action associated, you should recognize it. What happens when pressing Shift Left/Right on a wide item?
You may spend some more time for investigation or just implement your own PreTranslateMessage handler.
|
|
|
|
|
"I don't know which CGridCtrl you are using"
I am using this[^] one.
|
|
|
|
|
I have not used that so far. But I'm quite sure that the arrow keys are used to select cells when the Shift key is pressed too.
|
|
|
|
|
I guess it is my mistake !!! : I already have an accelerator, shift + left key, on menu item command ... if this is the cause, is there any possibility to know in CGridCtrlExt, of on CDialog which contain this control, to know when I pressed Shift and left key ?
|
|
|
|
|
If you have a global accelerator you have three options:
- From the accelerator handling check if your grid control is active and pass the message to that if so
- Add another accelerator table to your grid control
- Use PreTranslateMessage in your grid control
|
|
|
|
|
I will try your first solution. I'll come back.
|
|
|
|