|
Anyone tried Intel IPP libs with Multithreaded static linkage with dispatching?
I've got those link errors:
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __malloc_dbg already defined in MSVCRTD.lib(MSVCR100D.dll)
1>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRTD.lib(MSVCR100D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR100D.dll)
...
These are the libs I added as described in manual:
ippccemerged.lib
ippccmerged_t.lib
ippiemerged.lib
ippimerged_t.lib
ippjemerged.lib
ippjmerged_t.lib
ippcore_t.lib
ippsemerged.lib
ippsmerged_t.lib
libiomp5mt.lib
libirc.lib
However with non-multithreaded static linkage without libiomp5mt.lib all compiles perfectly
Чесноков
|
|
|
|
|
Look at the discussion here[^]. Similar problem, and the reason was a mix of debug and release builds.
Hope that helps.
|
|
|
|
|
There is no mix, I've got clean VS2010 console application created.
It clearly differentiate debug and release builds.
I found that only ignoring libcmt.lib resulted in correct linkage.
Intel IPP .libs are surely release built and there is no difference if you add them to debug or release version of the application.
Чесноков
|
|
|
|
|
Follow the suggestion by Niklas Lindquist.
If it still doesn't work you can force the linker to link multiple references.
Type /FORCE:MULTIPLE in Project -> Properties -> Configuration Properties -> Linker -> Command Line -> Additional Options .
|
|
|
|
|
What is the libcmt.lib? as only ignoring it resolved the problem.
Or it might be better to use Intel Compiler instead of VS with IPP Intel product?
Чесноков
|
|
|
|
|
libcmt.lib is a C runtime static library that supports multi threaded programs.
|
|
|
|
|
(just too lazy to create an account on sourceforge to ask in their forum)
I'm using CppCheck (cppcheck[^]) to occasionally check our code.
It reports a stylistic warning on a typedef enum :
c:\<path>\MyHeader.h(225): style: Enum 'MyEnum' hides typedef with same name
typedef enum
{
tata = 0,
toto,
titi,
...
tutu
} MyEnum;
I tried reproducing the warning on a smaller sample (copy the offensive code to a new project), but cannot "reproduce" the issue.
Any ideas ?
Thanks.
Max.
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: (just too lazy to create an account on sourceforge to ask in their forum)
Understood, but the probability of finding a CppCheck user on SourceForge's site is much greater than finding one on CodeProject's site. Don't you agree?
"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
|
|
|
|
|
yeah...
( i hate the voice of reason! )
Watched code never compiles.
|
|
|
|
|
Hai,
I have an exe in C++ which is connected to a Trade server and doing some operations based on the server.If the connection to this server is lost it should automatically reconnect.Is there Any solution for this
|
|
|
|
|
ShibuKizhepat wrote: Is there Any solution for this
Yes, client reconnects when it detects that the connection was interrupted. What have you tried so far and where have you been stuck?
ShibuKizhepat wrote: have an exe in C++
If this isn't your software then there is no solution "from the outside", but you can always contact the author and describe your scenario.
|
|
|
|
|
VC reporting some memory leaks in my application but without line number and file name. because of that i can't locate the leak.
Report is given below
Detected memory leaks!
Dumping objects ->
{159399} normal block at 0x04D98460, 1024 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{159398} normal block at 0x044E4F30, 36 bytes long.
Data: <HG ` ` > 48 47 97 01 A2 CD CD CD 60 84 D9 04 60 84 D9 04
{159397} normal block at 0x04D98028, 1024 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
{159396} normal block at 0x04CABF20, 68 bytes long.
Data: <(H ( ( > 28 48 97 01 A2 CD CD CD 28 80 D9 04 28 80 D9 04
{159393} normal block at 0x044F37F0, 36 bytes long.
Data: < 7O 8PN 7O > F0 37 4F 04 38 50 4E 04 F0 37 4F 04 CD CD CD CD
{159392} normal block at 0x044E5038, 36 bytes long.
{21242} normal block at 0x04507C18, 4 bytes long.
The program 'D:\Kty\Program\kty.exe' has exited with code 0 (0x0).
How can I locate leak?
|
|
|
|
|
First thing to do is to avoid manually managing memory - then you won't have so many options for leaking memory. Replace raw pointers with decent smart pointers or just use automatic objects where you can.
Secondly there are some biggish blocks in there. Have a look in you code for anywhere you use big buffers that you dynamically allocate. As the blocks are only 1k in size just throw them on the stack.
After that if you're still having problems start thinking about using a diagnostic new and delete so you can start getting a handle on what you're allocating and not freeing.
Cheers,
Ash
|
|
|
|
|
thanks for reply.
After that if you're still having problems start thinking about using a diagnostic new and delete so you can start getting a handle on what you're allocating and not freeing
"diagnostic new and delete" - Can u explain it in detail
|
|
|
|
|
There are some other hints in there as well. The compiler makes sure allocated memory is filled with the value 0xCD for debug builds. That way the debugger can warn the user if you're trying to read uninitialized data.
As you can see, both leaks of size 1024, seem to be unused. Also 1024 is a neat number, and I bet you could just search in your source code for '1024'. Someone is probably allocating a buffer they think is big enough for a task.
You can also see the 'CD' pattern in the other dumps, indicating how the original layout might be. Assuming you have not altered the packing, it looks like the first 36 byte leak comes from a class or struct. The reason being the 3 CD in the middle. The struct might look something like
struct (or class)
{
int n;
char c;
...
}; where the n is 26691400 in this case. Does that number fit in somewhere? Like a database table index or similar?
There are a lot of hints if you know how to read and interpret them.
|
|
|
|
|
|
see _crtBreakAlloc[^]
basically, add this line to the very start of your program:
_crtBreakAlloc(159399);
then, when the CRT does its 159399th allocation, it will break (like an assert) and you can look at the stack to see who requested the allocation.
|
|
|
|
|
#define new DEBUG_NEW
add this line to the beginning of source files witch you suspect leaking memory.
then the report will have file name and line numbers.
(sorry for my poor english.)
|
|
|
|
|
Hi!
I've declared a global structure. Inside the constructor, I've initialized the structure elements. But I got the following error:
Error 2 error C2758: 'CInitMenu::initMnuContext' : must be initialized in constructor base/member initializer list e:\CricketProject\Cricket\InitMenu.cpp 51
Here is my structure:
struct SAppContext
{
irr::IrrlichtDevice *device;
irr::s32 counter;
irr::gui::IGUIButton* m_pPlayButton,*m_pOptionsButton,*m_pCreditsButton,*m_pExitButton;
};
I've created a reference to this structure in side my class:
private:
SAppContext &initMnuContext;
irr::IrrlichtDevice *dev;
irr::gui::IGUIButton *m_pPlayButton,*m_pOptionsButton,*m_pCreditsButton,*m_pExitButton;
I'm assigning my class members to this structure elements like this:
CInitMenu::CInitMenu(irr::IrrlichtDevice* device)
{
dev = device;
gui::IGUIButton* m_pPlayButton = device->getGUIEnvironment()->addButton(core::recti(x,y,x+width,y+height),0,PLAY_BUTTON,L"Play");
gui::IGUIButton* m_pOptionsButton = device->getGUIEnvironment()->addButton(core::recti(x,y,x+width,y+height),0,OPTIONS_BUTTON,L"Options");
gui::IGUIButton* m_pCreditsButton = device->getGUIEnvironment()->addButton(core::recti(x,y,x+width,y+height),0,CREDITS_BUTTON,L"Credits");
gui::IGUIButton* m_pExitButton = device->getGUIEnvironment()->addButton(core::recti(x,y,x+width,y+height),0,EXIT_BUTTON,L"Exit");
initMnuContext.device = device;
initMnuContext.m_pPlayButton = m_pPlayButton;
initMnuContext.m_pOptionsButton = m_pOptionsButton;
initMnuContext.m_pCreditsButton = m_pCreditsButton;
initMnuContext.m_pExitButton = m_pExitButton;
What modifications has to be done to get code work?
|
|
|
|
|
You have declared the initMnuContext as a reference:
SAppContext &initMnuContext;
But you are using it as if it is not a reference! Simply remove the ampersand in the declaration:
SAppContext initMnuContext;
|
|
|
|
|
|
Hi All ,
I have a code :
int CExWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if(CWnd::OnCreate(lpCreateStruct)==-1) return -1;
CClientDC dc(this);
pDC.CreateCompatibleDC(&dc);
bitmap.CreateCompatibleBitmap(&dc,Width,Height);
pDC.SelectObject(&bitmap);
return 0;
}
void CExWnd::OnPaint()
{
CClientDC dc(this);
Draw ( pDC ) ;
dc.BitBlt(0,0,Width,Height,&pDC,0,0,SRCCOPY);
}
This is a example . I have a question . Why WM_PAINT auto update when compatible with pDC . ( the same CClientDC ) .
I'm not good at English . Sorry !!
Thanks .
|
|
|
|
|
The underlying DC in your CClientDC is where the drawing gets visible. You can use temporary DC's to do painting, but then you will have to transfer it to the 'visual' DC. That's what the BitBlt call is doing.
|
|
|
|
|
Can you share for me documentary about it ?
Thanks .
|
|
|
|
|
You can start by reading about device contexts here[^]
|
|
|
|