VS2019 : resource file error: Neutral (Default) (unknown sub-lang: 0x8) - c++

I'm following this tutorial to get started with win32api GUI programming. My VS2019 is completely standard but when i try to add a resource file i get the error:
A resource in this file uses an unknown language: Neutral (Default) (unknown sub-lang: 0x8). Unable to open this file.
I found something similar posted before, but the suggested fixes didnt work for me. i only have one language installed on my W10 machine. Any idea what could be wrong with my settings?
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

As suggested by Jeaninez setting my Window display language to English (United States) fixed the problem. This seems to align with the default settings in Visual Studio 2019.

Related

#ifdef gets lost in resource file

I have resource file which specifies a dialog. In this dialog I display the app name, version and if it is the 32bit or 64bit version of the program.
#ifdef WIN64
LTEXT "My App, Version 1.2.3.0 (64 bit)", IDC_APPLICATION_TITLE_TEXT, 42, 14, 251, 16, SS_NOPREFIX
#else
LTEXT "My App, Version 1.2.3.0 (32 bit)", IDC_APPLICATION_TITLE_TEXT, 42, 14, 251, 16, SS_NOPREFIX
#endif
This all works great, until I use Visual Studio to edit any of my dialogs, this triggers the resource file to be saved by VS and it strips out my #ifdef leaving only one of the entries (either 32bit or 64bit)
LTEXT "My App, Version 1.2.3.0 (64 bit)", IDC_APPLICATION_TITLE_TEXT, 42, 14, 251, 16, SS_NOPREFIX
My question is, is there a way to prevent VS from striping out the #ifdefs when I edit dialogs in directly in VS, or is there a way to construct the text used in the resource in a way that can be used in the resource.
The only way I know if is to edit the files by hand and NOT use the Resource Editor. Any #define or #ifdef get processed and then removed by the Resource Editor itself, and the "post processed" rc is what gets saved :-\
EDIT: You could stick the compiler directived resources in your .rc2 file, which is NOT processed by the Resource Editor. At least it's "localized" to entries in your RC2 file.
EDIT2: Here's a sample of our VS2019 .RC file for an MFC DLL that utilizes an .RC2 file for non-appstudio sections. Yours should be similar.
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "verrsrc.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#ifndef APSTUDIO_INVOKED\r\n"
"#include ""targetver.h""\r\n"
"#endif\r\n"
"#include ""afxres.h""\r\n"
"#include ""verrsrc.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"LANGUAGE 9, 1\r\n"
"#include ""res\\Utils.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
#ifndef _AFXDLL
"#include ""afxres.rc"" // Standard components\r\n"
#endif
"#endif\r\n"
"\0"
END
/////////////////////////////////////////////////////////////////////////////
#endif // APSTUDIO_INVOKED
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#include "res\\Utils.rc2" // non-Microsoft Visual C++ edited resources
#ifndef _AFXDLL
#include "afxres.rc" // Standard components
#endif
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
Note the two different sections of code for including the .RC2 file. One is for the RC Compiler grammar and one is for the Resource Editor itself (yes, strange).

Unable to add and include resources at compile time in Microsoft Visual Studio 2017 C++ project

I'm trying to add an image to a C++ application. In the solution explorer by clicking New Item -> Resource created Resource.rc file. In the Resource View added new resource, ie a Bitmap image. The resource.h file is
#define IDB_BITMAP1 101
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Resource.rc - relevant part
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENN)LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_INDIA
// Bitmap
IDB_BITMAP1 JPG "Street.jpg"
#endif // English (India) resources
The program runs without error inside the IDE. But when executed the exe generated by build, it seems the resource image file is not found. I am not able to include resources at compile time.
update
C++ sample code to load image and generate output image
#include <iostream>
#include "Open_eVision_2_11.h"
using namespace Euresys::Open_eVision_2_11;
using namespace std;
int main(){
EImageBW8 EBW8Image1; // EImageBW8 instance
// Display version - To make sure lib is included properly.
std::cout << "Open eVison Version: " << Easy::GetVersion();
try {
EBW8Image1.Load("Street.jpg");
EasyImage::Threshold(&EBW8Image1, &EBW8Image1, 140);
EBW8Image1.SaveJpeg("output_image.jpg");
std::cout << "\nImage generated!\n";
}catch (const EException&) {
std::cout << "Error: Possibly image not found!\n";
}
}
When the program is executed inside the IDE, the program generated the output image. But when created an installer, using this link, and installed using Visual Studio Installer and executing it is found that resource image not loaded properly. It prints out the library version and the catch part. Does this issues has something to related to the library, Open_eVision_2_11.h, used?

Gap in resource IDs for a new ATL project in Visual Studio 2010

When I create a brand new ATL project in Visual Studio 2010, resource IDs 102 and 105 are left out. Is this intentional or a bug? Do these IDs serve any purpose later in the project? Can I reorder the numbering to use these? Here is the resource file for a new project named TestID:
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by TestID.rc
//
#define IDS_PROJNAME 100
#define IDR_TESTID 101
#define IDR_PREVIEW_HANDLER 103
#define IDR_THUMBNAIL_HANDLER 104
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 106
#endif
#endif
ID 102 is left out then the next ID (_APS_NEXT_SYMED_VALUE) is set to 106 so 105 is left out too.
The reason is simple and it depends on the ATL Project you want to create.
I just looked into the folder \VC\VCWizards\AppWiz\ATL\ATLProject\templates\1033\ for the resource.h file.
[!if SERVICE_APP]
#define IDS_SERVICENAME 100
[!else]
#define IDS_PROJNAME 100
[!endif]
#define IDR_[!output UPPER_CASE_SAFE_PROJECT_IDENTIFIER_NAME] 101
[!if PREVIEW_HANDLER]
#define IDR_PREVIEW_HANDLER 103
[!endif]
[!if THUMBNAIL_HANDLER]
#define IDR_THUMBNAIL_HANDLER 104
[!endif]
[!if SEARCH_HANDLER]
#define IDR_FILTER_HANDLER 105
[!endif]
As you can see there are conditionals that are executed by the app-wizard code that might include also IDs with 104 and 105.
So to fit all cases the next free id is set to 106.
But you are free to renumber all existing resources.

fatal error RC1015

I am really new to programming for C++ and I was given the task to pick up were a previous employee left off with programming a windows mobile device. I had the emulator working the other week and now when I load the program I get:
Fatal error RC1015: cannot open include file "xxxx.h"
I have tried almost everything that I have seen on the internet without a single bit of luck. I think that one of my include statements is missing but every time I put one in that works something else breaks. Please any help will be greatly appreciated.
Here is what the .rc file says:
// Microsoft Visual C++ generated resource script.
//
#include "resourceppc.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "ConnectLoginDlgsRes.h"
#include "AboutDlgRes.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resourceppc.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""ConnectLoginDlgsRes.h""\r\n"
"#include ""AboutDlgRes.h""\r\0"
END
3 TEXTINCLUDE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#include ""res\\J3ItemListsppc.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""ConnectLoginDlgs.rc""\r\n"
"#include ""AboutDlg.rc""\r\n"
"#endif\r\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\J3ItemLists.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_J3ITEMLISTS_DIALOG DIALOG 0, 0, 156, 169
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION
EXSTYLE WS_EX_APPWINDOW | 0x80000000L
The problem is with the #include "ConnectLoginDlgsRes.h" line. The header file is in a shared folder that if it is added that it breaks somewhere else.
Any ideas? Like I said someone else started this and I get to figure it out.
Since you program for Windows Mobile we can assume that you use VS2005 or VS2008. You just need to set the search path for the resource compiler.
Lookup the missing file "ConnectLoginDlgsRes.h" and add the path in the project properties dialog. The path must be added in Configuration Properties->Resources->General. Use the "Additional Standard Include Path".
Edit:
Since your previous employee might have given you a working project you should also check the build environment. Probably you need some scripts to be executed before you can actually build the VS project.
If you are not using the resource.h file that is generated in Visual Studio. Make sure you delete the line that includes resource.h from [Solution]->[Project]->Resource Files->app.rc.
In your case this is the line:
'#include "resourceppc.h"'
I solved l error RC1015 using and running the vcvars32.bat file in command line environment which is found in the bin directory under the VC installation directory.or use everything tool to find it. It's limited to setting the appropriate environment variables to enable 32-bit x86 command-line builds. It's the equivalent of the vcvarsall x86 command.
https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx?f=255&MSPPError=-2147217396

How to Increment Visual Studio build number using C++?

I have a Visual Studio 2008 project that produces a file called: "Game-Release.exe".
This was configured under Project Properties -> C/C++ -> Linker -> General:
$(OutDir)\$(ProjectName)-Release.exe
I would like to take this a bit further by have an incrementing build number so I would have something which says:
Game-Release-Build-1002.exe
The number on the end should be an incrementing integer. I will be storing the build exe's on subversion so I think i would find this useful (although not necessary).
Perhaps there is a built in macro in Visual Studio that could handle this. Quite possibly I was thinking I could have a text file with the build number in it and have the compiler read, use and increment the number in the file each time the project is built. My goal is however to make the process as automated as possible. What is the best way to accomplish this?
If you offer an opinion, please also provide the code we can all share. Thnx.
The Versioning Controlled Build add-in seems like it would do the job.
Update: Your question specifically mentions using Visual Studio to increment the version, but there is nothing automated about that. Have you considered using Nant and a CI server? That way, it is easy to inject the SVN revision number into AssemblyInfo.cs equivalent for C++. Automatically, on the build server.
If you are using svn to version your project you could follow the instructions in this link it works perfectly for me because I can track bugs in a release application using its version information and comparing the source code.
All information below is not included in the link:
setup your rc file like this version.rc
#include "resource.h"
#include "version.h" //<-----------Don't forget the include
/////////////////////////////////////////////////////////////////////////////
//
// Version.rc
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILE_VERSION
PRODUCTVERSION VER_PRODUCT_VERSION
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "CompanyName", "Your Company Name"
VALUE "FileDescription", "Your Application Description"
VALUE "FileVersion", VER_FILE_VERSION_STR "\0"
VALUE "InternalName", "Internal Name"
VALUE "LegalCopyright", "CopyRight stuff - Copyright (C) 2015"
VALUE "OriginalFilename", "yourapp.exe"
VALUE "ProductName", "Your Application"
VALUE "ProductVersion", VER_PRODUCT_VERSION_STR "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1200
END
END
Next add version.h file to your project which defines everything, setup like this:
#include "svn_version.h"
#define STRINGIZE2(s) #s
#define STRINGIZE(s) STRINGIZE2(s)
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_REVISION SVN_REVISION
#define VERSION_BUILD 0
#if SVN_LOCAL_MODIFICATIONS
#define VERSION_MODIFIER "M"
#else
#define VERSION_MODIFIER
#endif
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
"." STRINGIZE(VERSION_MINOR) \
"." STRINGIZE(VERSION_REVISION) \
"." STRINGIZE(VERSION_BUILD) \
#define VER_PRODUCT_VERSION VER_FILE_VERSION
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
after this you can follow the link above.
I'm not sure VS2008 has that feature but I think you can do it with a post-linker event that runs a little script that make the task for you.
I use a pre-build script (written in JavaScript and executed using the cscript.exe engine) that defines the major/minor release, gets the SVN revision number and generates a magic build number based on the current date. The script then creates a version.h file that is used by the main application (and by the main apps resource file to create a VERSION resource).
My own approach, including binary file stamping:
http://indiocolifax86.wordpress.com/2010/05/22/a-scheme-for-automatic-build-numbers-in-cc-projects/