shlwapi.h compile errors in imported project - visual-studio-2019

I am trying to import a C++ MFC project from Visual Studio 2008 into VS 2019 community edition. The project originally came from outside my company long ago (like maybe twenty years). I am getting hundreds of compiler errors from an MFC include file named shlwapi.h because many symbols in it are multiply defined. Has anyone else seen this, and what can I do about it?
Edit: Here are some samples of the errors:
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Shlwapi.h(287,16): error C2084: function 'HRESULT SHLocalStrDupW(PCWSTR,PWSTR *)' already has a body
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Shlwapi.h(287): message : see previous definition of 'SHLocalStrDupW'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Shlwapi.h(293,16): error C2084: function 'HRESULT SHLocalStrDupA(PCSTR,PSTR *)' already has a body
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Shlwapi.h(293): message : see previous definition of 'SHLocalStrDupA'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\Shlwapi.h(916,5): error C2365: 'URL_SCHEME_INVALID': redefinition; previous definition was 'enumerator'
When I click on the first line, I am taken to this code:
// make the above helper function a bit easier to use in the HRESULT world
inline HRESULT SHLocalStrDupW(_In_ PCWSTR psz, _Outptr_result_maybenull_ PWSTR *ppsz)
{
*ppsz = StrDupW(psz);
return *ppsz ? S_OK : E_OUTOFMEMORY;
}
When I click on the second line, the one that says "see previous definition", I am taken to the same place. It's like the include guard at the top of the file isn't working.

Related

Delphi 11.1 is not adding my RC file during a build

I am trying to add additional icons into my project using Delphi 11.1.
I have produced the .rc file with links to the icon files, e.g:
FILES ICON "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\Icons And Images\PositronFiles.ico"
PROJECTS ICON "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\Icons And Images\PositronProjectFiles.ico"
I have added to the .dpr file:
{$R 'PSResource.res' 'PSResource.rc'}
But, on doing a full build, I get messages like this:
[dcc64 Hint] H2161 Warning: Duplicate resource: Type 14 (ICON GROUP), ID FILES; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource kept; file D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource discarded.
[dcc64 Hint] H2161 Warning: Duplicate resource: Type 14 (ICON GROUP), ID PROJECTS; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource kept; file D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PSResource.res resource discarded.
The resulting .res file does not include these extra resources.
I have also tried adding the files directly into the resource file using a Resource Editor. This ensures the resources are in the .exe file, but I cannot access them when I use Icon.LoadFromResourceName(Handle,'NAME'), where Handle is to the open window.
Am I doing something wrong?
EDIT:
I tried using the "Project > Resources and Images" dialog.
I removed all references to the .rc file and the file itself. Added the icons I wanted to add, did a build, and now get an error:
[dcc64 Error] E2161 Error: RLINK32: Unsupported 16bit resource in file "D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PositronStudio.dres"
The icon files comprise RGB/A images at resolutions of 64x64, 48x48, 40x40, 32x32, 24x24, 20x20, 16x16, and RGB 256 at 48x48, 23x23, 24x24, 16x16.
Are any of these unsupported?
I removed and reloaded the icons in "Resources and Images". Tried again and did a full build. The resulting .res file only contains the application icon.
I still get the warning
[dcc64 Hint] H2161 Warning: Duplicate resource: Type 24 (user-defined), ID 1; File D:\Documents\Embarcadero\Studio\Projects\Positron Studio\PositronStudio.res resource kept; file D:\Documents\tmssoftware\TMS VCL UI Pack\WINXP.RES resource discarded.
I renamed all the WINXP.* files, and removed all references within the project. Now I don't get the warning of duplicate resource files, but the resulting resource file after a full build still doesn't contain the added icons.
Checked in .dproj for .rc and RCCompile, neither were found.
After removing all the superfluous rc and res files I edited the res file to include the additional items I needed then did a build. This time the res file wasn't overwritten by the compiler. They are now embedded in the exe and I can access them in the application.
It has uncovered another issue in that I cannot change the Icon of a form at runtime. I will raise it as separate topic if I cannot find the solution.

Symbol table debug information is not added in dll (delphi) after build it from CMD dcc32

I am trying to generate a .TDS file for a .DLL compiled with the command-line dcc32.exe compiler and a .CFG configuration file.
At the time of converting, I see that my DLL file does not have a symbol table. To cross check this, I check the size of the DLL before and after compiling, and it is the same. Please tell me what I am missing in my .CFG file that prevents symbol table debug information from being added to the DLL.
I am using Delphi 10. My .CFG file is as follows:
/B
/H-
/GD
/W-
/$A+
/$B-
/$C-
/$D+
/$E-
/$F-
/$G+
/$H+
/$I+
/$J+
/$K-
/$L+
/$M-
/$N+
/$O+
/$P+
/$Q+
/$R+
/$S+
/$T-
/$U-
/$V-
/$W+
/$X+
/$Y+
/AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
/$M16384,2097152
/K4194300
/NSData.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;System.Win;Winapi;Vcl;Vcl.Samples;Vcl.Imaging
/CC
/DTDMDLL;BOMDLL;TRACE_INPUTBOX;
/IH:\Shared\INC
/UH:\Shared\PAS\PasController
/UH:\Shared\VCL
/UH:\Shared\VCL\TMS\Current\TMSComponentPack
/UH:\3rdParty\Delphi
/UH:\Tlbs
/UH:\3rdParty\HyperAct
/UH:\3rdParty\GifImage
/UH:\3rdParty\Abbrevia2\Product
/UH:\3rdParty\Microsoft
/UH:\3rdParty\Microsoft\IExtractImage
/UH:\Shared\INC
/UH:\Shared\Pas
/UH:\Shared\Internal
/UH:\\Shared\VCL\ElPack\Code
/UH:\Shared\VCL\ElPack\Code\Design
/UH:\Shared\VCL\QR1
/UH:\Shared\VCL\ElPack\Code\Source
/UH:\Shared\VCL\ShortcutBar
/UH:\Shared\VCL\Hebrew
/UH:\Shared\VCL\ToolBar
/UH:\Shared\VCL\PlasmaTools\Src
/UH:\Shared\DataModelDesign\InDbFunctions
/UH:\Shared\DataModelDesign\DistributedDesign
/UH:\Shared\DataModelDesign\DataModelDesigner
/UH:\Shared\BldKit\PUBLIC\KitRes\PAS
/UH:\Shared\VCL\xBom
/UH:\Shared\VCL\xDiff
/UH:\Shared\VCL\DEVEXP~1\Current\EXPRES~3\Sources
-RH:\Shared\VCL -RH:\Shared\BldKit\VER
;Append Project Local Setting
/U H:\Shared\VCL\DevExpress\Current\ExpressBars 5\Sources\
/UH:\BOM\SmartBomConsolidation
Also, how can I can generate a .PDB file for the DLL?

Resource compilation error (Bad character in source input)

I have added text file with following content to the project:
1 24 "MyApplication.manifest"
In the same folder there is also MyApplication.manifest file which is XML - this one:
C++ Builder / Delphi 2010 application manifest template
After I attempt to build resource from RC I get error - Bad character in source input(1)
Any ideas why?
RT_MANIFEST value is 24, but I am unsure what 1 is supposed to be.
I managed to find the answer myself so no answer necessary. The problem was, as usual very obscure.
Turned out that the resource script file (.RC) I was using had an UTF-8 byte order mark in the file (0xEF,0xBB,0xBF) which was invisible to the text editor but resource compiler complained about it. After removing the BOM resource compiled correctly.
I don't think many people fall into this trap but at least if anyone else sees this error in resource compiler, you should examine if there is an UTF-8 BOM in your file by viewing HEX-dump of RC file because brcc32.exe resource compiler seems to have issues with that.

How can I resolve these err msgs following a TFS "Get Latest Version (Recursion)"?

I was able to compile and run an .exe built in XP Mode with Visual Studio 2003. I then noticed the version of the source I was using was not up to date (based on a version number string). So I did a "Get Latest Version (Recursion)"
That gave me the correct version number, but also over 100 Build Errors, of thes types:
Two of these, but 2-clicking them goes nowhere:
"Error reading resources from the resource file for the default culture: Invalid ResX input. Could not find valid "resheader" tags for the .NET Compact Framework ResX reader & writer type names. Make sure this Resx file is a .NET Compact Framework Resx file."
Dozens of these; 2-clicking them also takes me nowhere:
"Object type cannot be converted to target type."
10 or a dozen of these:
"Resource transformation for file 'frmAbout.resx' failed. Invalid ResX input. Could not find valid "resheader" tags for the .NET Compact Framework ResX reader & writer type names. Make sure this Resx file is a .NET Compact Framework Resx file."
2-clicking those gave me this nice "Data for Data" grid:
Finally, several like this:
"'PDAClient.PrinterPickerForm' does not contain a definition for 'AutoScaleMode'"
...which take me to code like this:
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
Why would simply getting the latest version of code cause all this mayhem?

Delphi ReportBuilder Error: Unable to locate ppReport.pas

I am using reportbuilder 15.
I included unit ppReport, declared an object rptBuilder1 = TppReport in my pas file from where I have to call the print function. In my code while printing the report, I am using following line to call reportbuilder function
rptBuilder1.Print;
while pressing Ctrl + Click on Print method, RAD studio is not taking me to the ppReport.pas file which is there in C:\Program Files (x86)\Embarcadero\RAD Studio\11.0\RBuilder\Source
Note: I have already included above path in delphi environment
I don't know how, but it worked. I removed the path of RBuilder from Environment Options and then added again. Ctrr+Click worked.

Resources