Author Topic: windres option for mingw64  (Read 11329 times)

Offline reckless

  • Regular
  • ***
  • Posts: 349
windres option for mingw64
« on: February 18, 2011, 11:30:13 am »
i know i know ! this doesnt sound like a codeblocks subject but hear me out :)

what im after is a way to set windres options in codeblocks for tdm's mingw64 since my project fails to link unless i add -F pe-i386 to windres options for the 32 bit builds (besides the -m32 in linker and cflags).

any ideas where i might look in codeblocks to set such an option ?.

maybe something for a proposal to set these flags automatically if you select 64 bit build in codeblocks ?.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: windres option for mingw64
« Reply #1 on: February 18, 2011, 12:02:45 pm »
It's a little hacky, but you can add it directly in the toolchain executables tab, but it would be used for all projects in this case.

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: windres option for mingw64
« Reply #2 on: February 18, 2011, 12:15:16 pm »
thanks jens.

i did try this earlier unfortunatly it wont work (atleast not on my win7 box) codeblocks just throws invalid executable error on me :(

maybe i need to add the options in quotes ? or `` hmm...

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7256
Re: windres option for mingw64
« Reply #3 on: February 18, 2011, 12:27:01 pm »
thanks jens.

i did try this earlier unfortunatly it wont work (atleast not on my win7 box) codeblocks just throws invalid executable error on me :(

maybe i need to add the options in quotes ? or `` hmm...
I just tried on win7 64bit with windres.exe -F pe-i386 without any quotes and it works.

Offline reckless

  • Regular
  • ***
  • Posts: 349
Re: windres option for mingw64
« Reply #4 on: February 18, 2011, 01:00:35 pm »
hmm strange now it works after i restarted codeblocks :)

ok all good then and thanks for the help.

Offline G-Shadow

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: windres option for mingw64
« Reply #5 on: January 08, 2015, 03:36:58 pm »
Sorry for resurrecting this old topic. I had some problem and found other solution. While googling for solution, I found this topic is on the top, so I decided to answer here so that other could find my solution.
In my case I had two targets: x86 and x64, so I could not set global toolchain flags. My solution for per-target windres options:

1) In project build options add new "custom variable" for every windows target (in my case it is Debug-Win32, Release-Win32, Debug-Win64 and Release-Win64).

2) Give it some name (I used "rc_arch") and set value to "pe-i386" for x86 (win32) targets and "pe-x86-64" for x64 targets.

3) Click "properties" on the resource .rc file, select "Advanced" tab, check "Use custom command..." checkbox and copy default command from the hint below. Then add one more option: -F $rc_arch

In my case it looks like that: $rescomp $res_includes -J rc -O coff -F $rc_arch -i $file -o $resource_output

If you need other windres options, you could simply remove "-F" and rename $rc_arch to something line $rc_options and the add any target specific options for windres. Hope this helps to someone.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9702
Re: windres option for mingw64
« Reply #6 on: February 11, 2015, 08:03:52 am »
The next nightly will have this implemented natively so you can set/change these options on a per project/target level or within the global compiler options.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline G-Shadow

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: windres option for mingw64
« Reply #7 on: March 11, 2015, 05:53:52 am »
It`s a good news. Thank you very much, I`ll try it today!