Working on my first C++ project (unmanaged) in the VS.NET 2003 IDE (I've
been using VC++6 up until this point), I've been struggling for a couple of
days to simply embed a file as a resource into my executable.
I started off by trying to add a .jpg file. I selected Project/Add Resource
from the main menu, clicked Import and then selected the .jpg I want to add.
VS.NET 2003 opens a dialog box with a big red X icon, displaying the message
"No error occurred" (with just an OK button). However, I find that the JPG
has not been added to the project, and instead I have a resource of type
Bitmap with the ID IDB_BITMAP1. Double-clicking it displays an empty 48x48
pixel graphic, not the JPG I selected. Any ideas?
After deleting the BMP resource, I tried to add two other resources: a .tga
file containing a font and a .dat file containing metrics about the
characters within the font.
I imported the .tga file (using the same procedure as above), creating a new
resource type of TGA, and this worked and compiled fine. Then I imported the
.dat file, creating another new resource type of DAT. Upon compiling, I now
get the following error message:
error RC2135 : file not found: "RESOURCES\\FONTWIDTHS.DAT"
I've tried manually compiling the .rc file using the rc.exe utility and I
get the same error. I've also tried changing the double-backslash to a
single-backslash just in case, but it didn't make any difference. The
specified file definitely exists.
I also find that once I have added a resource file (the .tga file, for
example), the IDE takes AGES to open the project (in excess of a minute).
All the time it's doing this it just displays an empty window, with just the
tabs of the open source files at the top. Deleting the .sou file from the
project directory gets the project opening quickly again, but then I find
that the first source file I open (main.cpp for example) causes the huge
delay.
Can anyone help me out with any of this? I'm getting very close to dumping
the VS.NET2003 IDE and going back to VC++6...
My thanks in advance,

Signature
(O)enone
Oenone - 18 Sep 2005 09:33 GMT
> Working on my first C++ project (unmanaged) in the VS.NET 2003 IDE
> (I've been using VC++6 up until this point), I've been struggling for
> a couple of days to simply embed a file as a resource into my
> executable.
The complete lack of response to this is leading me to the conclusion that
either:
a) no one else embeds resources in their applications in C++
or
b) no one else has any problems with embedding resources
Could some of you at least give me a hint as to which is the case?
Thanks,

Signature
(O)enone
David Lowndes - 18 Sep 2005 18:48 GMT
>I started off by trying to add a .jpg file. I selected Project/Add Resource
>from the main menu, clicked Import and then selected the .jpg I want to add.
Did VS not prompt you for a custom resource type at this stage? That's
what VS2003 (& VS2005) does for me if I import a JPG file.
>After deleting the BMP resource, I tried to add two other resources: a .tga
>file containing a font and a .dat file containing metrics about the
[quoted text clipped - 6 lines]
>
> error RC2135 : file not found: "RESOURCES\\FONTWIDTHS.DAT"
I can't reproduce that either - but I don't have a suitable font DAT
file to try. Was the file in use maybe?
Have you tried the same things on a different PC - just wondering if
there's something odd with your VS installation?
Dave

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq