|
How do I get around this Warning?
warning LNK4049: locally defined symbol _printf imported
|
|
|
|
|
This[^] has got some interesting blurb as to why this happens. Follow the advice in there and see what happens.
As printf is a standard library function check that all your source files are being compiled to link with the same version of the runtime library. Without any more information I'd suspect that one file is being compiled to link with the static version of the runtime library and another is being compiled to link with the dynamic version of the library.
Either that or you're trying to do something a bit flash like library interpositioning. If you don't know what that is you're probably better off - it gives me sleepless nights.
Cheers,
Ash
|
|
|
|
|
Hallo,
I`m trying to add an Item in a CListCtrl List, but it does not work:
m_lstAssignments.ModifyStyle(0,LVS_REPORT|LVS_LIST);
m_lstAssignments.InsertColumn(0, _T("Description"), LVCFMT_LEFT,-1);
m_lstAssignments.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
m_lstAssignments.InsertItem(0,"TEST");
The List Control is just empty (no Header, no Items). What am I do wrong?
Thank you!
|
|
|
|
|
Joschwenk666 wrote: m_lstAssignments.ModifyStyle(0,LVS_REPORT|LVS_LIST);
Pick one style or the other, not both?
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I tried
m_lstAssignments.ModifyStyle(0,LVS_REPORT);
and
m_lstAssignments.ModifyStyle(0,LVS_LIST);
but nothing changes.
Another Idea?
|
|
|
|
|
Joschwenk666 wrote: Another Idea?
Have you tried:
m_lstAssignments.InsertColumn(0, _T("Description"), LVCFMT_LEFT, 100);
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Doesn`t work.
My Code is now:
m_lstAssignments.ModifyStyle(0,LVS_LIST);
m_lstAssignments.InsertColumn(0, _T("Description"), LVCFMT_LEFT, 100);
m_lstAssignments.InsertColumn(1, _T("Column2"), LVCFMT_LEFT, 100);
m_lstAssignments.InsertColumn(2, _T("Column3"), LVCFMT_LEFT, 100);
m_lstAssignments.SetColumnWidth(0, LVSCW_AUTOSIZE_USEHEADER);
m_lstAssignments.SetColumnWidth(1, LVSCW_AUTOSIZE_USEHEADER);
m_lstAssignments.SetColumnWidth(2, LVSCW_AUTOSIZE_USEHEADER);
m_lstAssignments.InsertItem(0,"TEST");
Nothing happens, the List is just empty, no header columns, no items...
Are there maybe propertys I have to set for my list in Resource Form View?
|
|
|
|
|
Using the LVS_LIST style implies no columns.
Joschwenk666 wrote: Are there maybe propertys I have to set for my list in Resource Form View?
I just tried your code with the default settings and "TEST" indeed showed up.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Oh, I`m really stupid: I put a Listbox Control on my form, not a List Control Control....
Tank you for your effords.
|
|
|
|
|
|
Anybody know of a utility that can fix the #includes in a given source file - remove ones that are not needed and add ones that are? Netbeans can do this for java, can it be done for VC++?
Jim
|
|
|
|
|
Years ago John Lakos wrote a utility to tell you what redundant includes you had in a bunch of source files. Unfortunately there's no way of knowing what's implemented in what header (apart from the standard ones) so working out which headers you need is a bit harder.
The best way of handling this is to keep your headers small and self-contained, then you can be fairly empirical about which ones you need. You can just remove all the headers and add back in the ones you really need.
Cheers,
Ash
|
|
|
|
|
>Unfortunately there's no way of knowing what's implemented in what header (apart from the standard
> ones) so working out which headers you need is a bit harder.
Visual Assist can work out which headers need including for a given object (I've discovered only recently).
But what I'm really looking for is a utility that can go through my whole project and strip redundant #includes and thus reduce unnecessary rebuilds. I'm going to google for John Lakos, see what I can find.
Thanks,
Jim
|
|
|
|
|
Visual Assist can only do this for headers you've got in your solution and the standard library. As far as I know it can't do something like say "hey, it looks like you're using a crypto function from OpenSSL..."
The Lakos code was originally published in "Large Scale C++ design" in the early 90s - I've seen it kicking around online several times but I haven't got a link handy.
Cheers,
Ash
|
|
|
|
|
I've found the book on Amazon, I'll add it to the list next time we update our office library.
Thanks, you've been very helpful!
Jim
|
|
|
|
|
There's always the brain-dead approach: comment some out and see if it still compiles.
Steve
|
|
|
|
|
I'm kinda wondering...Why not C++ reflection?
|
|
|
|
|
I think this is an already very well debated question, see for instance (OMG: the competitors!) [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Chapter 14 of "The Design and Implementation of C++" by Stroustrup has got a pretty good summary of why the type inspection abilities of the language are the way they are and why some of the things that are regarded as reflection aren't in the language. It's also got a fairly good C++ implementation of a dynamic object reader which shows you how you can get some reflection type abilities out of the language without too much work.
Cheers,
Ash
|
|
|
|
|
I need to render a image in progress bar control. Can anyone please help me how to do this.
Thanks in advance
|
|
|
|
|
The steps are:
1. Subclass the control
2. Handle WM_PAINT
3. Draw the graphics as you like.
|
|
|
|
|
Thanks for ur reply,
But my question is " How I can render a image in the progress bar, Suppose I hv a line image with green color and I want that line image should increase in progress bar ".
I hope u will help me. If possible plz send some code.
Thanks
|
|
|
|
|
If the image can be stretched you can do the following. (Its MFC and without error checking)
void CMyProgressCtrl::OnPaint()
{
CPaintDC dc(this);
CRect rc;
GetClientRect(rc);
int nLower, nUpper;
GetRange(nLower, nUpper);
int nPos = GetPos();
int nWidth = (int) ((nPos / (float) (nUpper - nLower)) *rc.Width());
BITMAP bm;
m_bitmap.GetBitmap(&bm);
CDC dc2;
dc2.CreateCompatibleDC(&dc);
CBitmap *pOldBitmap = dc2.SelectObject(&m_bitmap);
dc.StretchBlt(rc.left, rc.top, nWidth, rc.Height(), &dc2, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
dc2.SelectObject(pOldBitmap);
}
|
|
|
|
|
Thanks For ur response..
Could u plz tell me what is m_bitmap.GetBitmap(&bm) does. Becose I am getting assertion error at that line while running .
|
|
|
|
|
It's getting some general properties for the bitmap. In this case we are interested in the size of the image bmWidth and bmHeight members of the BITMAP struct, to be able to know how much to stretch the image.
If you get an ASSERT it could be because you have not loaded any bitmap yet. I assume m_bitmap is of type CBitmap and that it is declared as a member of CMyProgrssCtrl .
In the constructor (or Create and PreSubclassWindow ) do m_bitmap.LoadBitmap(IDB_BITAMP) where IDB_BITMAP is the bitmap you have in your resources.
|
|
|
|