# Using our own resource file?

**URL:** <https://forum.juce.com/t/using-our-own-resource-file/8768>\
**Category:** The Projucer\
**Created:** [June 1, 2012, 11:02am UTC](https://forum.juce.com/t/using-our-own-resource-file/8768 "2012-06-01T11:02:23Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 1, 2012, 11:02am UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/1 "2012-06-01T11:02:23Z")

</div>

Hello all/Jules,

Is there any way to let us use our own resource file on 'doze, i.e. just not inlcude your resource file in the project. A checkbox “Don’t generate resource file” would suffice…  
Our version numbers etc are a bit different from yours (1.2.3rc13) and we already have a whole macro system in place to define our version, app type, copyright message etc in one place per app. Our resource files use that info.

grts,

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2012, 1:30pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/2 "2012-06-01T13:30:07Z")

</div>

Not something I’ve ever considered… If you want to suggest code-changes to the introjucer that let you do want you want without messing-up anybody else’s build, then I’d consider it.

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 1, 2012, 1:49pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/3 "2012-06-01T13:49:03Z")

</div>

hey Jules,

Before I dive into the code: just not generating the resource file should be enough right?

I.e. Generate Resource File: checkbox (default on):

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2012, 1:54pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/4 "2012-06-01T13:54:38Z")

</div>

That’d be fine, but it would also remove any reference to it from the project, so how would you add a reference to your own file?

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 1, 2012, 2:05pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/5 "2012-06-01T14:05:35Z")

</div>

Just by including the resource file in the introjucer?

As long as it’s compiled it should be fine, no?

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2012, 2:08pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/6 "2012-06-01T14:08:12Z")

</div>

Probably not, I think it’d need special handling.

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 1, 2012, 2:46pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/7 "2012-06-01T14:46:41Z")

</div>

Just check and you are right…

What about something like this? It doesn’t mess up your code and leaves space for people to add more (or less) things to their rc’s.

```auto
#ifndef JUCE_USER_DEFINED_RC

#undef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0rc2,0
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "040904E4"
    BEGIN
      VALUE "CompanyName", "SampleSumo\0"
      VALUE "FileDescription", "CPGuiExample\0"
      VALUE "FileVersion", "1.0.0rc2\0"
      VALUE "ProductName", "CPGuiExample\0"
      VALUE "ProductVersion", "1.0.0rc2\0"
    END
  END

  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 65001
  END
END

#else
#include JUCE_USER_DEFINED_RC
#endif

IDI_ICON1 ICON DISCARDABLE "icon.ico"
```

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2012, 3:12pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/8 "2012-06-01T15:12:53Z")

</div>

That’s a really good idea! Sure, I’ll add something like that, thanks!

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 1, 2012, 3:31pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/9 "2012-06-01T15:31:53Z")

</div>

Huzzah!

- bram

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [June 4, 2012, 8:50am UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/10 "2012-06-04T08:50:05Z")

</div>

Hey Jules,

got some bad news: the resource compiler lives completely separate from the C++ compiler/linker and has its own preprocessor defines etc… That means that setting the include paths in the C++ compiler options doesn’t work (it just doesn’t see them)…

For vc2010:

```auto
    <ResourceCompile>
      <PreprocessorDefinitions>JUCE_USER_DEFINED_RC_FILE="\"VersionInfo.rc"\";_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalIncludeDirectories>../../../../Codebase;../../Source;</AdditionalIncludeDirectories>
    </ResourceCompile>
```

For vc2008:

```auto
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;JUCE_USER_DEFINED_RC_FILE=&quot;\&quot;VersionInfo.rc\&quot;&quot;"
				AdditionalIncludeDirectories="../../../../Codebase;../../Source"
			/>
```

Without these my proposed hack is useless… I’m not sure what to propose now! Adding these would open up things more again, but maybe not entirely what you want to add…

Let me know what u think,

- bram

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [November 28, 2012, 10:16am UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/11 "2012-11-28T10:16:33Z")

</div>

_bump_ ?

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 28, 2012, 2:16pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/12 "2012-11-28T14:16:41Z")

</div>

Can’t you just use an absolute path for your include file?

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [November 28, 2012, 2:31pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/13 "2012-11-28T14:31:40Z")

</div>

Mmmm, nope, because our RC file is shared among all our projects, which might be at different levels…  
Or you mean absolute as in “c:/…”? Because that would definitely not work with different developers…

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 28, 2012, 2:51pm UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/14 "2012-11-28T14:51:32Z")

</div>

Too overloaded to look at it right now… If you’re in a hurry, it might be worth having a look in the introjucer, it’s probably only a few lines of code to add that.

---

<div class="post-metadata">

**Author:** ![frankenburgh](https://avatars.discourse-cdn.com/v4/letter/f/df788c/32.png) [@frankenburgh](https://forum.juce.com/u/frankenburgh)\
**Post date:** [August 2, 2016, 11:20am UTC](https://forum.juce.com/t/using-our-own-resource-file/8768/15 "2016-08-02T11:20:24Z")

</div>

Hi! I don’t know if this is still of interests… I tried the same: change the version infos created by the resource.rc.  
The macro JUCE\_USER\_DEFINED\_RC\_FILE does not work because the resource-compiler has no configurable defines in the projucer.  
I have solved this problem by replacing the resource.rc file by an own one:  
Simply create an own .rc file like “userdefinedrcfile.rc” at the same location as resources.rc (in builds\VisualStudioxxx) and add the folowing into the “pre-build command” of each configuration:  
"copy userdefinedrcfile.rc resources.rc"  
In your own .rc file you can use #includes etc to use defines also.  
In my case something like that:

#include \<windows.h\>  
#include "…/…/Info.h"  
VS\_VERSION\_INFO VERSIONINFO  
FILEVERSION VERSION\_MAJ, VERSION\_MIN, 0, VERSION\_BUILDNR  
PRODUCTVERSION VERSION\_MAJ, VERSION\_MIN, 0, VERSION\_BUILDNR  
FILEFLAGSMASK 0x3fL  
#ifdef \_DEBUG  
FILEFLAGS 0x1L  
#else  
FILEFLAGS 0x0L  
#endif  
FILEOS 0x40004L  
FILETYPE 0x1L  
FILESUBTYPE 0x0L  
BEGIN  
BLOCK "StringFileInfo"  
BEGIN  
BLOCK "040904e4"  
BEGIN  
VALUE “FileVersion”, VERSIONINFO\_VERSION\_STRING "\0"  
VALUE “ProductVersion”, VERSIONINFO\_VERSION\_STRING "\0"  
VALUE “OriginalFilename”, VERSIONINFO\_FILENAME "\0"  
VALUE “FileDescription”, VERSIONINFO\_FILEDESCR "\0"  
VALUE “InternalName”, EFFECT\_NAME VERSIONINFO\_VERSION\_STRING "\0"  
VALUE “ProductName”, EFFECT\_NAME "\0"  
VALUE “CompanyName”, VERSIONINFO\_COMPANYNAME "\0"  
VALUE “LegalCopyright”, VERSIONINFO\_COPYRIGHT "\0"  
END  
END  
BLOCK "VarFileInfo"  
BEGIN  
VALUE “Translation”, 0x409, 1252  
END  
END

Each time you use the projucer the .rc file will be overwritten but on build, the right .rc file is used for the binary.

Frank.
