question

wdolson-7254 avatar image
0 Votes"
wdolson-7254 asked wdolson-7254 answered

Difficulty Linking x64 Version of a Program

I am working on a project that compiles and runs fine with the 32 bit version. This is using WinAPI, included DirectX, native code, VC 2017, exe project.

There are several calls to mmio functions, mmioOpen, mmioRead, mmioWrite, etc. According to the documentation this requires linking with the winmm.lib library in the SDK. I've done that for both the x86 and x64 versions. I have the correct path to both the x86 and x64 libraries in the directories.

The x86 version links fine and run. I have tried selecting several different toolsets. With older compilers and the XP versions of the newer compilers, the x64 throws a slew of L2019 errors at link time for the mmio functions.

When I switch to the VC2017 or VC 2015 toolset, I initially got other errors when using the 7.0 SDK the project was using, but when I switched to the 8.1 or 10.0 SDK, the errors went back to the same link errors.

c++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

wdolson-7254 avatar image
0 Votes"
wdolson-7254 answered

Sorry about the delay responding. This is my secondary project and the last week has been busy with my primary one.

Eliminating the DirectX include and library directory changed the behavior, but there are libraries and include files that are no longer used. The include files no longer used are dxerr8.h and dmplugin.h. I found this article about dxerr.lib.

I got around the include issues by including a complete path to the old DirectX SDK, but that's a temporary thing to get to the more serious issue. I still get 55 unresolved externals and three warnings that winmm.lib, dsound.lib, and user32.lib are all x86 versions and not x64.

I'm baffled where it thinks it's getting the libraries. I used dumpbin to look at the headers for the libraries in the locations I thought were being linked in and they all look to be x64 libraries. None indicate they are 32 bit. I did check the headers in some of the x86 directories to know what to look for in an library with the wrong header.

I experimented taking out the directories one by one and there were some that weren't needed. Removing the old DirectX directories did eliminate all the L2019 errors.

I'm hamstrung by On the DX issues the fact the primary programmer on this project is one of those eccentrics that can crank out tons of code. He's self taught, but he's actually managed to create a game that needs tweaks, but is amazingly stable and fast. He only uses CRT monitors and the only compiler he will use is VC 6. When the project started he was using Windows 2000, but I think he upgraded to XP.

He's built all the DirectX stuff around I think DX 7. I'm not completely sure. I made a new project to build the game and it builds fine for x86 with the XP build tools on, but I don't think that's going to work for x64.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JeanineZhang-MSFT avatar image
0 Votes"
JeanineZhang-MSFT answered

Hi,

@wdolson-7254

When I switch to the VC2017 or VC 2015 toolset, I initially got other errors when using the 7.0 SDK the project was using, but when I switched to the 8.1 or 10.0 SDK, the errors went back to the same link errors.

According to the Doc: Where is the DirectX SDK?

Starting with Windows 8, the DirectX SDK is included as part of the Windows SDK.

As far as I'm concerned , it is the reason for this phenomenon.

With older compilers and the XP versions of the newer compilers, the x64 throws a slew of L2019 errors at link time for the mmio functions.

I suggest you could refer to the link: https://docs.microsoft.com/en-us/windows/win32/directx-sdk--august-2009-?redirectedfrom=MSDN#using-directx-sdk-projects-with-visual-studio

Best Regards,

Jeanine




If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.