|
My project still won't build. I get these two errors:
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
nafxcw.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
My project statically links to MFC, as otherwise I get a million other errors trying to link to a library we use. It explicitly ignores libcmt.lib, as otherwise it clashes with msvcrt.lib. Any help at all will be greatly appreciated.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Are you compiling with /MD set ? You need to if you want to link with msvcrt.lib. I ask because I seem to remember that you said you used /MT and that causes linking with libcmt.lib.
|
|
|
|
|
OK - I have to compile with /MT because otherwise I can't link to an external library I am using. I am explicitly excluding libcmt from my lib list, but if I exclude msvcrt, I get more errors. Does this mean I am still linking with some libraries that use /MD ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes, it does. I am really surprised that a library requires you to use /MT. What ever. I use /MD nearly always. What ever.
All modules need to compile with the same RTL type selected and it looks like it is /MT for you.
Best of luck with it.
|
|
|
|
|
The deal is basically that no matter how often I compiled with /MD, it plain would not link, I suspect the library is linking other stuff that I don't have the source to, and causing this problem there, although the library builds with /MD
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I seem to remember having this error once when building the zlib library. I think it ended up being a single/multithread issue, but I can't be certain.
I found this at Microsoft, don't know if it will help:
Article
He is smart. He will make our Windows go.
|
|
|
|
|
Thanks - this article kind of reiterates what I knew, but I think I have to bite the bullet and find another solution for my problems building with /MD. Obviously, something is not set to /MT and I don't know what it is.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I have an app. that spends most of its time as a daemon process in the background. I want it to be able to detect when a user logs in or 'switches user' to themselves. Anyone know how to detect a 'switch user' event given that the app. is already running?
Thanks.
|
|
|
|
|
|
|
I coded:
<br />
long i;<br />
HWND *hWnd;<br />
hWnd = (HWND *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 10 * sizeof(HWND));<br />
SetWindowLong(hWnd[0], 0, i);<br />
...<br />
...<br />
hWnd = (HWND *) HeapReAlloc(GetProcessHeap(), hWnd, HEAP_ZERO_MEMORY, 11 * sizeof(HWND));<br />
i = GetWindowLong(hWnd[0], 0);<br />
this code corrupts all hWnd[0], ... , hWnd[9]. but HeapReAlloc only moves data.
i understand that hWnd is not only a data. its memory location is also important. now, can you tell me why its location is important?
-- modified at 18:01 Tuesday 30th August, 2005
|
|
|
|
|
It's not.
Off the top of my head i would suggest changing the HeapReAlloc to:
hWnd = (HWND*) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, hWnd, 11 * sizeof(HWND));
You have the flags and mem parameters swapped.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Well I'll be BLANKED. I read this earlier and did not see that detail.
Pesonaly I would have just used an MFC container class (like CArray) or an STL class.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
The devil is indeed in the details.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Sorry a lot!!!!!!!!
I was only made a mistake in writing this message. but the problem exist.
|
|
|
|
|
Ok, what about the fact that you alloc hWnd and then call SetWindowLong() on a NULL handle ?
...cmk
Save the whales - collect the whole set
|
|
|
|
|
good afternoon, all
I got all the messege every time I used dev studio debugger.
Loaded 'C:\WINNT\system32\ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\KERNEL32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\USER32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\GDI32.DLL', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\COMDLG32.DLL'
Loaded 'C:\WINNT\system32\SHLWAPI.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\ADVAPI32.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\rpcrt4.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msvcrt.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\comctl32.dll', no matching symbolic information found.
Loaded 'C:\WINNT\system32\SHELL32.DLL', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\WINSPOOL.DRV'
Loaded 'C:\WINNT\system32\mpr.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\OLEAUT32.DLL'
Loaded 'C:\WINNT\system32\OLE32.DLL', no matching symbolic information found.
The program 'C:\DEV\C++\Billing\ChkCalc\Debug\ChkCalc.exe' has exited with code 0 (0x0).
the MSDN says "This occurs if you have installed a Microsoft application that updates core system files, such as COMCTL32.DLL or OLE32.DLL, to versions that are newer than the operating system version or service pack for which you have installed symbols."
would this effecting my application though? how could I get rid of them without delecting some useful apps? thank you!
|
|
|
|
|
wrote:
how could I get rid of them
I am going to guess that you mean getting rid of the error messages. You can get rid of the error messages by installing the debug symbols.
I might be wrong but I think that you can safely ignore those particular messages.
|
|
|
|
|
This has no effect on your program and can be ignored.
I do not know if there is any way to get rid of them, nor why you would want to.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
If you are using VS7 or later, there's a way to automatically obtain the symbol files for Microsoft DLLs. Once you have it configured (it only requires setting an environment variable) the IDE will automatically download the symbol files from a Microsoft server and store them in your machine.
In this link you can get the details about how to Use the Microsoft Symbol Server to obtain debug symbol files[^]
--
jlr
http://jlamas.blogspot.com/[^]
-- modified at 0:41 Wednesday 31st August, 2005
|
|
|
|
|
is the FilePointer set and got through SetFilePointer and GetFilePointer same for reading and writing?
If yes, Does it mean I cannot read and write from/to different locations of the file at the same time?
Thanks.
|
|
|
|
|
You cna't have a file open more than once, only one thing at a time can open it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Huh?
Sure you can, you just have to NOT deny shared read and write access.
I think you can not 'simultaneously' read and write using the same FILE handle at the same time. You have to update the file position yourself prior to each read and write. And I would make darn sure they were atomic, in case your reading and writing are in separate threads. At which point it would just be easier to open the file twice, get a separate handler for reading and a separate handle for writing.
|
|
|
|
|
You can share access to a file, but you can not read and write to the file at the same time.
MSDN->SetFilePointer->Remarks:
"You must synchronize access to shared resources."
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Whenever you create/open a file via CreateFile() you get an opaque handle, but behind the scenes a structure is allocated to maintain state information for that handle.
This state contains a single variable that represents the current position in the file.
So, with proper file sharing parameters to CreateFile(), you could open the same file with 2 CreateFile() calls, getting 2 handles. Each handle maintains its own file position state.
Therefore, you should be able to use 1 handle to write and the other to read.
...cmk
Save the whales - collect the whole set
|
|
|
|