|
Forget this. No matter what I do I can't get my old code to use a static library in vc7. Here's the kicker, my code HAS to use a static library in vc6. For some reason I can no longer use the linked dll in vc6. This is messed up. I'm going home.
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
|
Debug build?
Have you disabled the new /GS option?
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Yes, I tried it with the Buffer Security Check turned off but that didn't effect performance at all.
"If debugging is the process of removing bugs from code, programming must be the process of putting them in."~~Dykstra
|
|
|
|
|
Hi, gurus,
I created a worker thread in CMyView using
AfxBeginThread(MyThread, GetSafeHwnd());
and my worker thread is declared as:
UINT MyThread(LPVOID pParam);
If I want to use a data member (m_nData) of CMyView in MyThread(), how I can get it using (HWND)pParam?
Any hint is highly appreciated!
|
|
|
|
|
Can you afford passing the address of the CMyView object itself to the thread, rather than the HWND ? I.e. why not call AfxBeginThread(MyThread, this) , which gives you access to the whole object, its m_nData member and its HWND (through m_hWnd member.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Got it. Done. Thank you so much!
(I feel so stupid sticking to GetSafeHwnd)
|
|
|
|
|
Hi !
I´m currently coding an application that displays graphically mathematical curves (with a CDC). I´d like to implement a zoom on it, that is: the user clicks, and when he moves the mouse while holding the mouse button down, the prg draws a rectangle with dot lines. When the user stops maintaining the mouse button down, it zooms-in. (The whole thing acts like selecting two or more icons on the desktop of windows, for example).
Well, i actually want to know an easy way to draw the rectangle with dot lines ... because I suppose it must be another way than saving the background, drawing the rectangle, and - when the user moves - redisplaying the saved background and redrawing the rectangle, must´nt it?
RaGe
Unfortunately, brute-force solutions tend to be slow
even when performed by modern-day microcomputers,
which are capable of several MIPS except when I'm late
for an appointment and want to finish a compile and
run just one more test before I leave, in which case
the crystal in my computer is apparently designed to
automatically revert to 1 Hz.
-- Michael Abrash
|
|
|
|
|
Try DrawFocusRect. It works in XOR mode - drawing it twice removes it from the screen.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
An alternative to Tomasz' suggestion is using <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_crecttracker.asp">CRectTracker</a> .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I am very close to losing my sanity trying to build some code with visual c++. I am sure the problem will have a very simple solution but i could do with some help none the less.
I have a program with six source code files and six associated header files, they all compile fine but when trying to link i get the following error.
test.obj : error LNK2001: unresolved external symbol "void __cdecl mht_associate(struct tracker_struct * *,struct measurements_struct * *,struct parameter_struct *,int,double * * *,int,int,int,int)" (?mht_associate@@YAXPAPAUtracker_struct@@PAPAUmeas
urements_struct@@PAUparameter_struct@@HPAPAPANHHHH@Z)
Debug/mht.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
The funcion being called in a file test.c and is defined in a file mhtwrapper.h, the code is contained in mhtwrapper.c.I have checked for all the simple mistakes that i can think of, such a spelling errors and i have tried declaring the function as external with no joy. When i run dumpbin on the mhtwrapper.obj file the function symbol does seem to be defined.
Symbol index: 10 Base line number: 14
Symbol name = _mht_associate
0000001B( 15) 00000022( 16) 00000029( 17) 00000030( 20)
00000037( 22) 0000003E( 23) 00000058( 25) 00000072( 27)
00000091( 28) 00000093( 29) 00000095( 30) 000000A6( 32)
000000B5( 34) 000000C4( 35) 000000D5( 37) 000000E8( 38)
000000FB( 39) 0000010E( 41) 0000012A( 43) 00000146( 45)
00000175( 46) 000001A4( 47) 000001D3( 48) 000001D8( 49)
000001DD( 50) 000001ED( 51) 000001FF( 52) 00000211( 53)
0000021D( 54) 00000229( 55) 00000235( 58) 0000023C( 59)
0000025A( 61) 00000278( 63) 00000297( 64) 000002CB( 67)
000002DB( 69) 000002F3( 70) 0000030D( 73) 00000316( 74)
00000326( 76) 00000342( 78) 00000387( 79) 0000039F( 81)
000003EE( 82) 000003F0( 83) 000003F5( 84) 000003FA( 85)
000003FF( 86) 00000404( 87) 0000041B( 89) 00000445( 91)
0000044E( 92) 0000046C( 94) 0000047C( 95) 00000498( 98)
000004D8( 101) 00000518( 103) 00000534( 106) 0000057F( 109)
000005CA( 110) 000005CF( 111) 000005D4( 113) 000005FB( 114)
00000624( 115) 00000639( 118) 0000063E( 120) 0000064A( 123)
and
010 00000000 SECT3 notype () External | _mht_associate
tag index 0000001A size 0000066E lines 00000DA8 next function 00000000
Any advice would be gratly appriciated.
Thanks
Scott Sims
|
|
|
|
|
Well, I had a similar problem the other day when compiling some c code with the settings (calling convention) set for __cdecl when it should have been __stdcall...
(Don't laugh folks - someday one of these pitifully lame suggestions will actually help someone, and _then_ I'll be cool... )
|
|
|
|
|
Thanks but i have allready tried and it has no effect
Scott Sims
|
|
|
|
|
Excuse my insistence, but that name mangling thing caught my eye... is your test program file actually called test.c and not test.cpp ? The compiler seems to be producing C++ code, not C. Also, the mhtwrapper.obj dump suggests that mht_associate is being compiled with extern "C" (not to be confounded with __cdecl ) name decoration.
If this is all obvious to you please feel free to ignore my post --but I thought it might be worth pointing out, just in case.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I think you might be on the right track but i am a little lost, the test file was called test.cpp and not test.c which i have now changed. The change in file type seems to make no ovious difference, i still get the same error. But when i try to add the extern "C" to the decloraction of the unresolved function i get the following error,
extern "C" void mht_associate(struct s1 **a,
struct s2 **b,
struct s3 *c,
int d,
double ***e,
int f,
int g,
int h,
int i);
g:\work\qunetiq mht\mhtwrapper.h(11) : error C2059: syntax error : 'string'
Thanks
Scott
|
|
|
|
|
OK... So you have to anwer yourself a question: Do you want the wrapper thing to work in C++ or in C? If it's the former, change everything to .cpp , forget about extern "C" , and everything should be right. If it's the latter, then you might be in trouble, cause that string seems to be C++ std::string , which of course cannot be included in a C program. Anyway, this is like walking in the dark a little code would go a long way.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I assume from what you are saying is that some code appears to be compiling as C++ and other code as C(I need platform independent pure C code) and the linker is struggling with this. So is there a compiler switch to force the compiler into pure C. Im sorry about the lack of code but unfortunatly that is unavoidable.
Thanks for your time
Scott
|
|
|
|
|
OK, pure C. Then, rename everything to .c , drop every extern "C" out and do a fresh rebuild (Project -> Rebuild All.) What's the result now?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Doing as you said had no effect but by adding \Tc to the compiler options forces pure C and i now have got the program running, thank you very much for your help it is greatly appriciated.
Scott
|
|
|
|
|
Well, you are welcome. Anyway, please note that you don't have to do anything special in VC++ to have .c files compiled as C. It is as if someone altered your VC++ settings to get the compiler to evilly treat .c files as C++.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
...but we think you're cool anyway Tim. Don't we guys.
guys?
cheers,
Chris Maunder
|
|
|
|
|
Sure... rub it in why doncha...
|
|
|
|
|
(Wild guess) Traces suggest C++ name mangling is in effect. Could it be you have to fix some extern "C" declarations somewhere?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have tried allready this with no effect, thanks anyway.
Scott Sims
|
|
|
|
|
You don't say if you're using MFC or WTL. If WTL, the LNK2001 error is caused when you try to do a Release build of a program that requires MSVCRT. Remove the compiler directive _ATL_MIN_CRT or remove the function call that requires the C RunTime library (malloc, printf, etc.).
|
|
|
|