Author Topic: Symbol redefinition?  (Read 629 times)

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Symbol redefinition?
« on: August 07, 2022, 02:43:55 AM »
Hi Biterider!

I'm trying to build a 2 years ago project (32 bits, other machine) and I have strange errors of this kind:
Code: [Select]
\Objasm-C.1\Code\Inc\Windows\\winapifamily.inc(29) : Error A2143: Symbol redefinition: WINAPI_PARTITION_DESKTOP
Code: (winapifamily.inc) [Select]
28:  ifndef WINAPI_PARTITION_DESKTOP
29:    WINAPI_PARTITION_DESKTOP equ (WINAPI_FAMILY eq WINAPI_FAMILY_DESKTOP_APP)
30:  endif

How is posible a redefinition? Any idea?

Thanks in advance, HSE
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1045
  • ObjAsm Developer
    • ObjAsm
Re: Symbol redefinition?
« Reply #1 on: August 07, 2022, 03:16:10 AM »
Hi HSE
"WINAPI_PARTITION_DESKTOP" is one of the symbols defined by MS to group the header files to reduce the load on the compiler and speed up the compilation process. This grouping also exists in the "include" files.
A redefinition can occur when the WINAPI_PARTITION_DESKTOP declaration is included more than once. For that reason I would look into the includes and try to figure out where it is being redefined.

Is this happening on any of the OA projects?  :rolleyes:

Biterider


HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #2 on: August 07, 2022, 03:50:12 AM »
Biterider,

A redefinition can occur when the WINAPI_PARTITION_DESKTOP declaration is included more than once.

Even inside ifndef ... endif?

Is this happening on any of the OA projects?  :rolleyes:

No. OA package projects and my last year projects don't have any problem.

Thanks, HSE
Equations in Assembly: SmplMath

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #3 on: August 07, 2022, 03:55:56 AM »
This are settings of project. Obviously there was som chnge because at that time apparently WinHelpers.inc was not in defaults.

Code: [Select]
% include @Environ(OBJASM_PATH)\Code\Macros\Model.inc
SysSetup OOP, WIN32, ANSI_STRING, DEBUG(WND)

% includelib &LibPath&Windows\shell32.lib
% includelib &LibPath&Windows\shlwapi.lib
% includelib &LibPath&Windows\comdlg32.lib
% includelib &LibPath&windows\Comctl32.lib

% include &MacPath&Exception32.inc

;% include &MacPath&WinHelpers.inc           commented in August 2022
% include &IncPath&Windows\CommCtrl.inc
% include &IncPath&Windows\Richedit.inc
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1045
  • ObjAsm Developer
    • ObjAsm
Re: Symbol redefinition?
« Reply #4 on: August 07, 2022, 04:12:56 AM »
Hi HSE
To be sure, I've attached an .asm file with the includes you specified, which assembles correctly on my system.
Please check if this is the case on your computer.

Biterider

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #5 on: August 07, 2022, 04:21:11 AM »
 :thumbsup: No problem
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1045
  • ObjAsm Developer
    • ObjAsm
Re: Symbol redefinition?
« Reply #6 on: August 07, 2022, 04:32:17 AM »
Hi HSE
If this works, then I think you maybe are including some file elsewhere in the source without realizing it.

Biterider

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #7 on: August 07, 2022, 05:05:11 AM »
Biterider,

If this works, then I think you maybe are including some file elsewhere in the source without realizing it.

Yes, somewhere there is something  :biggrin:

Thanks, HSE

Equations in Assembly: SmplMath

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #8 on: August 08, 2022, 08:21:29 AM »
Hi Biterider!

I found a duplicated inclusion of same object  :biggrin:

Very curious there is not check of that. Could be interesting for next time I make the same  :biggrin:

Must not be ofensive, of course:
Code: [Select]
% ifdef ??ObjExpr
%     .err 100001 Take a better beer, ??ObjExpr is already declared
  endif 

  ??ObjName textequ ??ObjExpr     ;;Global symbol used in all comming defs

For sure there was something else because I can't reproduce includes error messages   :rolleyes:

Thanks, HSE
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1045
  • ObjAsm Developer
    • ObjAsm
Re: Symbol redefinition?
« Reply #9 on: August 09, 2022, 03:13:39 AM »
Hi HSE
Some time ago I implemented a mechanism to prevent further compilation on some common errors.
I extended it to support multiple inclusions in the attached experimental code.
This way, unnecessary error messages are avoided!
I haven't checked all path possibilities, so if you have some time, please try it.  :biggrin:

While testing the new code I noticed that some things are broken in UASM. For example, the .err directive no longer works. The @Line symbol doesn't seem to be there either.  :sad:

Biterider

HSE

  • Member
  • *****
  • Posts: 2257
  • AMD 7-32 / i3 10-64
Re: Symbol redefinition?
« Reply #10 on: August 09, 2022, 05:22:28 AM »
Hi Biterider

I haven't checked all path possibilities, so if you have some time, please try it.  :biggrin:

Don' worry. With time, I will make all possible errors :biggrin:

While testing the new code I noticed that some things are broken in UASM. For example, the .err directive no longer works.

For 32 bits I use modified versions of JWAsm15, Asmc28 or UAsm46 with long lines. JWAsm is from last version, others are older versions.

In that versions ".err" work well in main file. With includes and macros usually lost track. Nidud impoved that.

The @Line symbol doesn't seem to be there either.  :sad:

That never worked in JWasm family. I think I asked Nidud but answer for sure is gone  :biggrin:

HSE
Equations in Assembly: SmplMath

Biterider

  • Moderator
  • Member
  • *****
  • Posts: 1045
  • ObjAsm Developer
    • ObjAsm
Re: Symbol redefinition?
« Reply #11 on: August 09, 2022, 07:32:47 AM »
Hi HSE
For 32 bits I use modified versions of JWAsm15, Asmc28 or UAsm46 with long lines. JWAsm is from last version, others are older versions.
In that versions ".err" work well in main file. With includes and macros usually lost track. Nidud impoved that.
Good to know...

Biterider