Author Topic: tdm-gcc 32/64 bit targets under windows  (Read 8167 times)

Offline Russell

  • Multiple posting newcomer
  • *
  • Posts: 30
tdm-gcc 32/64 bit targets under windows
« on: July 12, 2014, 02:27:07 am »
Hello :)

I need to add a 32bit target to a project I am working on. Currently I use the tdm-gcc compiler and have to add the line "-F pe-i386" in toolchain->resource compiler, this is very undesirable as it affects ALL projects that are loaded with the IDE.

Is there a better way to accomplish this? I tried overriding the $recomp variable in the target itself to: "windres.exe -F pe-i386", this does not work

Thanks

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: tdm-gcc 32/64 bit targets under windows
« Reply #1 on: July 12, 2014, 02:55:53 am »
I would try file properties and see if a custom compile command/string works for a single file.
If multiple files, I am not sure what I would do.

Edit: I would guess this string
Code
$rescomp -F pe-i386 $res_includes -J rc -O coff -i $file -o $resource_output

Tim S.
« Last Edit: July 12, 2014, 03:14:25 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Russell

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: tdm-gcc 32/64 bit targets under windows
« Reply #2 on: July 12, 2014, 03:34:50 am »
This works perfectly, thank you stahta01 :)

For those that are curious, I placed a variable named RCFLAGS into Build Options->Custom Variables, the value is "-F pe-i386" without quotes.

Right click on the resource file in the project and go to Properties->Advanced tab, click "Use custom build command for this file" and enter:

$rescomp $rcflags $res_includes -J rc -O coff -i $file -o $resource_output

For the 64bit target, I made the RCFLAGS value empty
« Last Edit: July 13, 2014, 01:46:23 am by Russell »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: tdm-gcc 32/64 bit targets under windows
« Reply #3 on: July 12, 2014, 12:00:11 pm »
What is the real problem here? You're using 64bit compiler to build 32bit executables?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: tdm-gcc 32/64 bit targets under windows
« Reply #4 on: July 12, 2014, 05:29:57 pm »
Why not creating a 64-bit and a 32-bit toolchain with the same compiler executables ?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: tdm-gcc 32/64 bit targets under windows
« Reply #5 on: July 12, 2014, 05:31:57 pm »
I think he is building both 32 bit and 64 bit targets in the same project.

That was what I based my suggestion on.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: tdm-gcc 32/64 bit targets under windows
« Reply #6 on: July 12, 2014, 05:38:52 pm »
I think he is building both 32 bit and 64 bit targets in the same project.

That was what I based my suggestion on.

Tim S.

You can have different compilers for different targets.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: tdm-gcc 32/64 bit targets under windows
« Reply #7 on: July 12, 2014, 09:41:33 pm »
I think he is building both 32 bit and 64 bit targets in the same project.

That was what I based my suggestion on.

Tim S.

You can have different compilers for different targets.

Yeah, but, having different CB Compilers for the same real world compiler seems wrong to me.

But, I would do it with two compilers myself; because I do NOT wish to have issues where MinGW64 headers are required to build a project by accident.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Russell

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: tdm-gcc 32/64 bit targets under windows
« Reply #8 on: July 13, 2014, 01:44:57 am »
Hi All

I am using the standard tdm-gcc toolchain, which according to the manual: "TDM-GCC is a multilib bootstrap of GCC's x86_64-w64-mingw32 target, built to run on 32-bit or 64-bit Windows and generate binaries for 32-bit or 64-bit Windows.", I believe this is the same toolchain used to build the codeblocks nightlies.

I am using tdm-gcc to generate both 32 and 64 bit binaries of the same project, it works extremely well for this and I haven't encountered any mingw64 header issues at all

I could not find a solution to having both a 32 and 64 bit target in the same project, mainly due to the resource compiler. Tim's suggestion was perfect because I only have 1 resource file per project anyway

Hope that clears up the confusion
« Last Edit: July 13, 2014, 01:49:16 am by Russell »