0

Well, I have a C ++ project, in which I use GCC + MinGW to compile that works perfectly. But I need to attach a binary file to my output file and I'm trying to do this per resource, but when I try to compile, it gives the following error:

C:/Program Files (x86)/CodeBlocks/…/ld.exe: i386:x86-64 architecture of input file ‘…\resources.res’ is incompatible with i386 output

Here is the file code resource.rc

#include "resource.h"

IDR_FILE BIN DISCARDABLE "../bin/File.dll"

Here is the code for the resource.h file

#define IDR_FILE 541

I tried the same thing in VC++ 2015 and it worked perfectly.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92
TheUser
  • 25
  • 4

1 Answers1

0

According to the build log it seems that the resource is built in 64-bit mode (ld.exe: i386:x86-64 architecture of input file '..\Files\User\resources.res'), but you are compiling the executable in 32-bit (the "-m32" option). Then it cannot link both together because of the mismatch.

Supposed that the dll is 64-bit, try to switch the compiler to 64-bit (use the "-m64" flag, not sure how exactly to switch it in CodeBlocks). Otherwise you would have to switch the windres to 32-bit (possibly by "--target=pe-i386", see here: TDM-GCC w64 script to change windres for 32bit?).

EmDroid
  • 5,918
  • 18
  • 18