Answer Questions
Rizzlers Unresolved externals and wchar_t's
I'm getting the following errors when compiling my program in VS2005b2. This program uses a 3rd party static lib and associated header files, so I can't change them. I think it was originally compiled in eVC++4.0. Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public : int __cdecl CL2CapIf::SetSecurityLevel(wchar_t *,unsigned char , int )" (__imp_ SetSecurityLevel@CL2CapIf@@QAAHPA_WEH@Z) referenced in function __unwind$66570 STPStack.obj Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public : enum SDP_RETURN_CODE __cdecl CSdpService::AddServiceName(wchar_t *)" (__imp_ AddServiceName@CSdpService@@QAA AW4SDP_RETURN_CODE@@PA_W@Z) referenced in function __unwind$66570 ST ...Show All
dagfari How to get the float value
i have some problem about the calculation value float scalex = 1024/800; float scaley = 768/600; the scalex and scaley value shld be 0.78125 for both, but the value i get is 1.0000, just wondering how to get the float value. try double or long value. still u fail try doing casting to float. Modify your code like this, float scalex = static_cast<float>(1024)/static_cast<float>(800); float scaley = static_cast<float>(768)/static_cast<float>(600); ...Show All
Ed.Richard Spawn invalid argument: Fails at VS2005 but was working at VS2003
Hi, I'm just trying to convert some sample code from VS2003 to VS2005. Now this line was working fine at VS2003: nPid = _spawnl( _P_WAIT, "process.bin" ,NULL); But if fails at VS2005, returning invalid argument. I have also tried: nPid = _spawnl( _P_WAIT, ".\\process.bin\0" ,NULL); nPid = _spawnl( _P_WAIT, ".\\process.exe\0" ,NULL); Of course, process.h is included. So what has changed with spawning at VS2005 Thanks in advance. Thanks for the tip Marius. While I would like to know where to look up the list of error codes, I followed the debugger and it seems that it never returns a value, it crashes before doing it. However, la ...Show All
Mathieu Cupryk IAT loop crash.
//Btw, this is not my source code, and i dont claim it to be. #include <windows.h> #include <winnt.h> using namespace std; int main(int argc, char *argv[]) { HMODULE hMod = GetModuleHandle(NULL); IMAGE_DOS_HEADER * dosheader=(IMAGE_DOS_HEADER *)hMod; IMAGE_OPTIONAL_HEADER * opthdr = (IMAGE_OPTIONAL_HEADER *) ((BYTE*)hMod+dosheader->e_lfanew+24); IMAGE_IMPORT_DESCRIPTOR *descriptor= (IMAGE_IMPORT_DESCRIPTOR *)(BYTE*) hMod + opthdr->DataDirectory[ IMAGE_DIRECTORY_ENTRY_IMPORT]. VirtualAddress; //the following loop crashes(seems to be because it doesnt recognise when their are no more descriptors. ) while(descriptor ->FirstThunk) { char*dllname=(char*)((BYTE*)hMod+ descriptor ->Name); ...Show All
hipswich Small executables
Hello. I'm working on a project where file size matters. I'm compiling an empty project about 6-7 kb-s. is there anyway to get smaller file Managed executables are generally smaller than native executables, so you might have seen one of those. Other than that, there are a number of tricks you can apply to get smaller output, such as replacing the C runtime library. Articles and texts describing the procedures can be found on MSDN, CodeProject, Codeguru, and a bunch of other sites. For one, you can read through http://msdn.microsoft.com/msdnmag/issues/01/01/hood/ . thanks, I know about packers. I will use them, but what I want is that I saw some compiled exe files which were 3 kb. so I wonder, is there any way i can compile exe ...Show All
suddenelfilio Convert LRESULT to LPCWSTR in c++
I am working on windows mobile 5.0 ,compact framework I want's to show a LRESULT in the message box. But as message box can only show LPCWSTR. So please provide me a routine to convert LRESULT to LPCWSTR so that I can show it in the message box. What header file I have to include as I am getting this error Error 1 error C3861: '_itow_s': identifier not found ... LONG lr = RegSetValueEx(hKey, NULL, 0, REG_SZ, (LPBYTE) wszValue, (lstrlen(wszValue) + 1) * sizeof(TCHAR)); wchar_t buf[20]; _itow_s(lr, buf, 20, 10); MessageBox(0, buf, L"Register 2", 0); It's in <stdlib.h> and you should have gotten it automatically with #include <windows.h>. For older versions, use _wtos(lr, ...Show All
Derol error LNK2001
Hi, (I saw the post on same subject but it seems to be a little different. so I'll use some word from that post!) There is a project earlier written in VC++ 6.0. I opened the same project in VS. NET 2005 and I am trying to compile. The code compiles properly (with couple of warnings) but while linking I am getting unresolved external symbol errors like this: The linker seems to have problem with seeing .obj from files in program (which are in the debug directory). It doesn't seem that the /Zl switch or the /NODEFAULTLIB are on. 1>Linking... 1>Utm.obj : error LNK2001: unresolved external symbol _RTC_Shutdown 1>Zone.obj : error LNK2001: unresolved external symbol _RTC_Shutdown 1>Zones.obj ...Show All
Seidel1 Use win32 dll in the window application
Hi, I try to reuse my code from a win32 console application to a window application project, Then I try to make dll of win32 project and add it to the new window project, but I get error that said my win32 project is not .Net assembly. Can some one show me how to reuse my code or do I have to copy paste all the code and recompile it Thank you in advance, sorry for my poor english To use unmanaged Win32 Dll in other C++ application, you need to add .lib file to the Linker dependencies list, include Dll interface h-file to the client project .cpp file, and call Dll functions. This way works both for unmanaged and managed client. Unmanaged Win32 Dll cannot be added as reference, this way works only for .NET class libraries. ...Show All
nglow Strip debug info from an obj or lib?
In VC 2005 what tool can I use to strip (remove) debug info from an already built LIB or obj file Did you lose the VS6 versions of shell32.lib and uuid.lib I can email them to you if you need them (t--x.org, is that correct ) It's a third party library I want to remove the debug info from. I need to have a clean shell32.lib and uuid.lib for some legacy DLL that needs VC 6.0. Those libs have debug info in them that is incompatible with VC 6 (i.e. the lib is unusable due to an error message "debugging information corrupt"). Although most libs in the Platform SDK are pure import libraries (no static objs in them) some of the libs in the SDK contain ...Show All
USACoder How to configure runtime library in MSVC++ 8 (2005)
hi, We can configure the runtime library option in MSVC++ .net (2003) using a drop-down list in "Project -> Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library" . I don't see the link "C/C++" in the MSVC++ .net 8 (2005) "Project -> Properties -> Configuration Properties". Can you kindly guide me how to set the run time library for multi-threading in MSVC++8 (2005) Click on one of your .cpp files, then go to properties. Additionally, all VC++ 2005 crt libs are multi-threaded. Choices are static, dynamic, debug and release. The preferred method is dynamic for both debug and release (MD and MDd). ...Show All
rsknowles error LNK2001
Hi, (I saw the post on same subject but it seems to be a little different. so I'll use some word from that post!) There is a project earlier written in VC++ 6.0. I opened the same project in VS. NET 2005 and I am trying to compile. The code compiles properly (with couple of warnings) but while linking I am getting unresolved external symbol errors like this: The linker seems to have problem with seeing .obj from files in program (which are in the debug directory). It doesn't seem that the /Zl switch or the /NODEFAULTLIB are on. 1>Linking... 1>Utm.obj : error LNK2001: unresolved external symbol _RTC_Shutdown 1>Zone.obj : error LNK2001: unresolved external symbol _RTC_Shutdown 1>Zones.obj ...Show All
Frank2808 Other lanuguages (Japanese) strings in quickwatch while debugging
Hi everybody, I am seeing a peculiar thing, i.e when I debug I getting japanese strings in Quickwatch while debugging a VC++ Project in wchar_t array. I using wsprintf(pExeFile,(LPCWSTR)"%s",pModuleFile); If I use char array instead of wchar_t it is showing the following error. The error is error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char [512]' to 'LPWSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast Pls help me in resolving this, Thanks and regards, Bharath .k Depending on your problem, I think you should use one of these: char * pExeFi ...Show All
Sqnyy fatal error C1902: Program database manager mismatch; please check your installation
Hi, I am having trouble getting my MSVC Express 2005 / Platform SDK environment (downloaded from Microsoft about two weeks ago) so that it can compile debug binaries. If I don't give cl the -Zi option, I can compile and link correctly, but with -Zi, I get the following: $ /cygdrive/e/users/cmiss/physiome_builds/trees/xpcellml_api/cygwin-wrapper cl -c -Zi -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -EHsc -TP -nologo -MD -D__WIN32__ -DXP_WIN -DXP_WIN32 -D__x86__ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/obj-i686-pc-cygwin/stablexr/dist/include/xpcom/ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/obj-i686-pc-cygwin/stablexr/dist/include/nspr/ -I/cygdrive/e/users/cmiss/physiome_builds/trees/mozilla_trunk/o ...Show All
robertlamour MessageBox not displaying japanese text
- chinese text installed on machine - Studio 2003/2005 - properties/general/charecter set -> Use Unicode Charecter set - properties/c/c++/Preprocessor Definitions -> _UNICODE;UNICODE - create d a sample c== console application - wchar_t test[2]= {0x3053,0}; - MessageBox(NULL,test,TEXT("Note"),MB_OK); - displays right text - wchar_t test[] = _T("how are you in japanaese"); - MessageBox(NULL,test,TEXT("Note"),MB_OK); -displays why would specifying vaues from unicode table work but not a text. any thoughts Thanks Hello Re: MessageBox not displaying japanese text Sorry ...Show All
Eric van Feggelen Vector Based Game
I was looking to write a vector based game. Mainly its to learn not to entertain. i want to code it in c++ and was wondering if someone could point me to a few resources; i have had some trouble finding any code examples. Hello Re: Vector Based Game Such questions are outside the scope of this forum - for the scope of the VC General forum please look at: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=19445&SiteID=1 For such issues please use the newsgroups at http://msdn.microsoft.com/newsgroups (although I hope some of the links suggested above help too) . OTP Thanks Damien MIND magazine has had some game progra ...Show All
