Constant redefinition warnings RX4005 when working in VO Windows-Editor

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4343
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by robert »

Chris,

I thought about that too, but that only works when a customer (re)opens and saves all the forms.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
FFF
Posts: 1538
Joined: Fri Sep 25, 2015 4:52 pm
Location: Germany

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by FFF »

Robert,
i'm certainly not qualified to comment - but "more control" always sounds good to me.
If your 5) would possibly allow including 4), i.e. making the proces smarter, i'd vote for it.
Regards
Karl
(on Win8.1/64, Xide32 2.19, X#2.19.0.2.)
User avatar
ArneOrtlinghaus
Posts: 394
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by ArneOrtlinghaus »

Chris,
we tested with the newest version of the VOXPorter we have. It writes the constants as decimal values and not as hex values.

Arne
HansjoergP
Posts: 116
Joined: Mon Jul 25, 2016 3:58 pm
Location: Italy

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by HansjoergP »

At the moment the VOXPorter defines the values as int. It is read in the array of xPorter.SDKDefines[cUpper] as string. In theory it is possible to convert it to a int64 and format it as a hexstring in Generate_Resources in the following case

CASE xPorter.SDKDefines:ContainsKey(cUpper)

Hansjörg
User avatar
robert
Posts: 4343
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by robert »

Guys,
Regardless of what the XPorter does, I will add a setting to the project file (and in the project settings dialog) in the next build that allows you to suppress warnings from the resource compiler about duplicate defines (RC4005)
What should the default be:
- suppress the warnings ?
- show the warnings ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
ArneOrtlinghaus
Posts: 394
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by ArneOrtlinghaus »

In my opinion the duplicate constant warning from the resource compiler is not critical, as the constants are defined just there locally. So the default could be "Suppress".

Arne
User avatar
Chris
Posts: 4641
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by Chris »

I agree, it's best to suppress the warnings by default.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
VR
Posts: 101
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by VR »

Hansjörg was able to fix this problem. First, he updated the source of the VOXPorter. That had no effect on the created .rc files. After debugging the VOXPorter, we were able to identify the source of the problem and fix it. Hansjörg changed the following Line from

Code: Select all

aDefines:Add(cUpper , String.Format("#define {0} {1}" , cWord , cValue))
to

Code: Select all

aDefines:Add(cUpper , String.Format("#define {0} 0x{1:x8}" , cWord , Int64.Parse(cValue)))
By doing so, the defines in the .rc files changed from

Code: Select all

#define WS_CHILD 1073741824
to

Code: Select all

#define WS_CHILD 0x40000000
Since the define numbers format is now equal to the format, that the form designer generates, the warnings disappeared.
User avatar
Chris
Posts: 4641
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Constant redefinition warnings RX4005 when working in VO Windows-Editor

Post by Chris »

Hi Volkmar,

That's a good idea, will update also the standard VOXporter code to emit values in hex format.

But in any case, by default VOXporter (at least the version that is available since some months ago) does not emit #define statements anyway at all, it instead uses the actual values everywhere they are needed in the resource files. This was done in order to avoid similar problems to the one we are discussing now, and this feature can be disabled by unchecking the option "ReplaceResourceDefinesWithValues"
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Post Reply