“An attempt was made to load a program with an incorrect format” even when the platforms are the same

前端 未结 20 2982
悲&欢浪女
悲&欢浪女 2020-11-22 13:57

I\'m calling functions from a 32-bit unmanaged DLL on a 64-bit system. What I get is:

BadImageFormatException: An attempt was made to load a program w

20条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 14:38

    In Visual Studio, Right Click your project -> On the left pane click the Build tab,

    Project properties, build tab

    under Platform Target select x86 (or more generally the architecture to match with the library you are linking to)

    Project properties, platform target

    I hope this helps someone! :)

提交回复
热议问题