简体   繁体   中英

VS2012 looking for 64bit dll instead of 32bit

I am having problems setting up opengl project. I am following this tutorial . I am able to build it without errors or warnings, but when I execute it I get 0xc000007b error.

It seems my Win32 applicaton tries to load 64bit freeglut.dll in C:\\Windows\\SysWOW64, because when I deleted it from C:\\Windows\\SysWOW64 I got error: The program '[3124] Project1.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.

Also in Output I can see:

'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\ntdll.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\kernel32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\KernelBase.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\opengl32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\msvcrt.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\advapi32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\sechost.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\rpcrt4.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\sspicli.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\cryptbase.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\gdi32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\user32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\lpk.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\usp10.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\glu32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\ddraw.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\dciman32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\setupapi.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\cfgmgr32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\oleaut32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\ole32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\devobj.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\\Windows\\SysWOW64\\dwmapi.dll'. Symbols loaded.

What can I do? Thank you

Edit: Pasting 32bit dll directly in visual studio 2012\\Projects\\Project1\\Debug fixes the problem! Why doesnt application look into C:\\Windows\\System32 folder for library?

Things in SysWOW64 are not 64-bit. Those are DLLs used for Windows on Windows (Microsoft's 32-bit translation layer). Basically you have a 64-bit version of Windows, and that is where it stores the 32-bit DLLs.

You actually have it backwards in your head, believe it or not. 64-bit DLLs reside in C:\\Windows\\System32 on a 64-bit system, as strange as that may sound. Microsoft probably had every intention of using System64 but so much software is/was hardcoded to use System32 and Win32 that the 32 almost has no meaning anymore.

If you want to put your freeglut DLL in a single central location, put it in the working directory Microsoft Visual Studio is configured to run your project from. You can put it in Project1\\Debug as you mentioned, but this means you also have to put a copy of freeglut in Project1\\Release for your software to function correctly in release builds. Visual Studio actually has a separate working directory in the project configuration ("Debugger | Working Directory") where it will run your program from when you press "Execute" or "Debug" - this is the directory your freeglut DLL should go in to avoid having to put a copy in each build configuration's output directory.

When you ship your software, put it in the same directory as the .exe , but for development take advantage of the projects's working directory. In any case, you should never put a DLL into an Operating System directory unless you know what you are doing. There is a reason you need administrator privileges to write anything to either of the directories you mentioned.


In fact, the author of the tutorial you linked needs to be reprimanded for improperly explaining the function of System32 and SysWOW64 and suggesting you install your DLL to either of those two locations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM