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
Related
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).
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.
I am working on a legacy MFC application which is used to review result files.
This is built as 64-bit code.
My problem is that on adding Dialog to one of the project, the application fails to launch with error:[The program '[102276] APP.exe' has exited with code -1073741502 (0xc0000142) 'DLL Initialization Failed'.]
Even after deleting the dialog and removing all related references in resource files, the application again fails with 'DLL Initialization Failed' error.
I would be grateful for all the help that I can get.Thank you!
Existing project was developed in VS 2010. Currently build environment is VS 2013.
On adding new dialog, resource file (.rc) got updated. However, the following piece of code was missing on the generated file.
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#include "res\(ResourceFile).rc2" // non-Microsoft Visual C++ edited resources
#endif
Adding the above line resolved the issue.
AFX_IDP_PARSE_INT is the id for a standard MFC error message (it's defined in afxres.h), but in my project it fails to load, meaning that LoadString returns FALSE, GetLastError returns ERROR_RESOURCE_NAME_NOT_FOUND, and CString stays empty.
This happens even when I try loading it at the beginning of InitInstanse:
BOOL CMyLegacyProject::InitInstance()
{
CString string;
if (!string.LoadString(AFX_IDP_PARSE_INT))
AfxMessageBox(_T("Failed."));
}
This same code works on a new project, however - same linking of MFC (I link to it statically), same WINVER, I've tried making it as similar as my old project, but I can't reproduce the error on a newly started project.
It looks like your resources are not building correctly. Make sure your .rc file includes all the AFX resources as well. First I'd try building a brand new project from scratch, test loading the string in that, and then have a look to see what the default .rc file looks like.
It should be including a file called 'afxres.rc', ie your RC should have something like this in it:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\MyRes.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#include "afxprint.rc" // printing/print preview resources
#endif
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/