ifdef not working in resource file

1.1k views Asked by At

I'm trying to use:

#include "Resource.h"

#ifdef __x86_64
IDR_D3D9X43     BINARY              "D3DX9_43_64.dll"
#else
IDR_D3D9X43     BINARY              "D3DX9_43_32.dll"
#endif

in my resource file (.rc). When I compile for x64, it should include the x64 resource. When I compile for x32, it should include the x32 resource. However, it does not..

It is being compiled using:

x86_64-w64-mingw32-g++.exe -Wall -fexceptions -O2 -m64 -std=c++11  -c C:\Users\School\Desktop\TestLoader\main.cpp -o obj\Release\main.o
windres.exe --target=pe-x86-64  -J rc -O coff -i C:\Users\School\Desktop\TESTLO~1\RESOUR~1\Resource.rc -o obj\Release\Resources\Resource.res
x86_64-w64-mingw32-g++.exe  -o bin\Release\TestLoader.exe obj\Release\main.o  obj\Release\Resources\Resource.res -s -m64 -static -static-libgcc -static-libstdc++  

Output file is bin\Release\TestLoader.exe with size 3.02 MB

for x64 compilation and it uses:

x86_64-w64-mingw32-g++.exe -Wall -fexceptions -O2 -m32 -std=c++11  -c C:\Users\School\Desktop\TestLoader\main.cpp -o obj\Release\main.o
windres.exe --target=pe-i386  -J rc -O coff -i C:\Users\School\Desktop\TESTLO~1\RESOUR~1\Resource.rc -o obj\Release\Resources\Resource.res
x86_64-w64-mingw32-g++.exe  -o bin\Release\TestLoader.exe obj\Release\main.o  obj\Release\Resources\Resource.res -s -m32 -static -static-libgcc -static-libstdc++  

for x32 compilation.

Any ideas why it does not conditionally include the specific resource? It always includes the first resource at the top of the file.. aka the x64 one.

0

There are 0 answers