Author Topic: Writing file information to exe  (Read 5552 times)

Offline O-san

  • Multiple posting newcomer
  • *
  • Posts: 25
    • OddGames
Writing file information to exe
« on: April 02, 2011, 09:45:54 am »
Is it possible to write file information in CB to the built executable. I am talking about the information that is available when you look at the properties of a file; product name, publisher, product language etc. I think in xcode and vc these things can be handled from within the IDE. Is there something similar in CB?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Writing file information to exe
« Reply #1 on: April 02, 2011, 10:19:38 am »
Is there something similar in CB?
Use a proper resource file for this purpose and add it to your project so that it get compiled / linked in. I remember that there was a template in the forums...
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 ptDev

  • Almost regular
  • **
  • Posts: 222
Re: Writing file information to exe
« Reply #2 on: April 02, 2011, 10:22:25 am »
Code::Blocks doesn't provide you with any user interface for this.

However, you can manually add this information to your resources file (usually called resource.rc).

Two useful links:

Stackoverfl0w: How to change an executable's properties discussion.
MSDN: Resource-definition statements.

Thinking about it, it would be nice to have such a plugin :)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Writing file information to exe
« Reply #3 on: April 02, 2011, 10:40:44 am »
Thinking about it, it would be nice to have such a plugin :)
Why a plugin? All you need is a resource file template which is here in the forums, or the link to Stackoverfl0w ptDev provided. Updating the version fields to your needs is very easy! There is really no need for a fancy UI. I mean: It's like writing a plugin that creates Hello World apps. :lol:

EDIT: Here is the link I mentioned in the forums (my own post btw...)
http://forums.codeblocks.org/index.php/topic,6775.msg51955.html#msg51955
« Last Edit: April 02, 2011, 10:45:04 am by MortenMacFly »
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 O-san

  • Multiple posting newcomer
  • *
  • Posts: 25
    • OddGames
Re: Writing file information to exe
« Reply #4 on: April 02, 2011, 11:01:12 am »
Thanks! That bit of info was what I was looking for. I had already a resource file for the program icon. However, for some reason the VERSIONINFO block is not present after building the exe. The field in the file properties window is just empty. :(

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Writing file information to exe
« Reply #5 on: April 02, 2011, 11:02:59 am »
Thanks! That bit of info was what I was looking for. I had already a resource file for the program icon. However, for some reason the VERSIONINFO block is not present after building the exe. The field in the file properties window is just empty. :(
Are you sure that it gets compiled/linked in? Please post a full build log (see my sig).
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 O-san

  • Multiple posting newcomer
  • *
  • Posts: 25
    • OddGames
Re: Writing file information to exe
« Reply #6 on: April 02, 2011, 11:09:27 am »
I thought I had done it right (saved the RC file, cleaned the project, did a complete rebuild)... because the program icon showed. So I commented out the icon line, just to be sure. And my custom program icon disappeared and was replaced by a generic icon. Then.. I brought back the icon line in the resource file (together with the versioninfo strings). Now both the icon and version stuff are visible. Strange...

Well it works, thanks a bunch!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Writing file information to exe
« Reply #7 on: April 02, 2011, 11:22:17 am »
Well it works, thanks a bunch!
Good to know.

One more tiny thing: We don't respect non-development related commercials in footers of messages. I've removed your footer on purpose (twice now). This forum is not dedicated to make commercials about private webpages. Please respect our forum rules. It's OK to leave it in the Website link though (as it is a neutral link), as long as it is no commercial branding or SPAM.
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 O-san

  • Multiple posting newcomer
  • *
  • Posts: 25
    • OddGames
Re: Writing file information to exe
« Reply #8 on: April 02, 2011, 11:49:22 am »
Ah, okay sorry about that