Author Topic: Symbol not defined  (Read 552 times)

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Symbol not defined
« on: June 20, 2018, 05:26:34 AM »
Hi
I want to report a long-standing error reporting problem which is the "Error A2102: Symbol not defined: ...", that reports an incorrect file & line number.
It reports one of the project files and a non-existent line number.
I would expect it to indicate the file and line number where an unspecified symbol occurred.

It is not urgent but annoying  ::)

Biterider

habran

  • Member
  • *****
  • Posts: 1174
    • uasm
Re: Symbol not defined
« Reply #1 on: June 20, 2018, 07:54:13 AM »
Can you provide a source file which is causing that error?
Cod-Father

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Symbol not defined
« Reply #2 on: June 20, 2018, 07:07:37 PM »
Hi Habran
I will prepare a test case by this weekend.
Biterider

habran

  • Member
  • *****
  • Posts: 1174
    • uasm
Re: Symbol not defined
« Reply #3 on: June 20, 2018, 07:37:58 PM »
 8)
Cod-Father

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Symbol not defined
« Reply #4 on: June 22, 2018, 04:52:17 PM »
Hi
Short update: I created a small project of 8 files, where one includes the next. Since I could not trigger the described problem, I went back to a more complex project and found that the line number correct but not the filename.
Maybe that helps a bit  ;)
I will try different things with the test case.

Biterider

habran

  • Member
  • *****
  • Posts: 1174
    • uasm
Re: Symbol not defined
« Reply #5 on: June 22, 2018, 05:34:27 PM »
Keep up good job :t
Are you using the modified exe or normal one?
Try to switch them.
Cod-Father

HSE

  • Member
  • ****
  • Posts: 803
  • <AMD>< 7-32>
Re: Symbol not defined
« Reply #6 on: June 22, 2018, 11:55:59 PM »
Hi!
We have talked about the same before. It's a jwasm problem. Nidud solved for AsmC exactly a year ago.
.  Bad file names in errors messages. 

habran

  • Member
  • *****
  • Posts: 1174
    • uasm
Re: Symbol not defined
« Reply #7 on: June 23, 2018, 02:32:29 PM »
Thanks HSE :t
I have implemented that in attached UASM.
Biterider, try if it fixes that problem. It is still with #IF fix.
Cod-Father

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Symbol not defined
« Reply #8 on: June 23, 2018, 03:07:18 PM »
Hi
Perfect, the bug is gone  :eusa_dance:
Thanks everybody!

Biterider

LiaoMi

  • Member
  • ***
  • Posts: 287
Re: Symbol not defined
« Reply #9 on: June 29, 2018, 01:21:02 AM »
Thanks HSE :t
I have implemented that in attached UASM.
Biterider, try if it fixes that problem. It is still with #IF fix.

Hi habran,

is it possible to publish a revised version, where the "Symbol is not defined" already fixed, but without editing the conditions for "IF".

Many thanks in advance  :P

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Symbol not defined
« Reply #10 on: June 29, 2018, 02:43:50 AM »
Hi LiaoMi
Did you have a problem with the "#if" hack? This could be important to know to understand a possible compatibility issue.

Biterider

habran

  • Member
  • *****
  • Posts: 1174
    • uasm
Re: Symbol not defined
« Reply #11 on: June 29, 2018, 05:06:20 AM »
The release version of UASM.exe posted above is with fix for #if, affecting only if 0 and, which is safe and should be rejected with masm as well.
IF defined(SYMBOL) and (SYMBOL ge 1020) gets converted in first pass to IF 0 and (SYMBOL ge 1020) if SYMBOL is not defined and IF 1 and (SYMBOL ge 1020) if SYMBOL is defined.
There are some other small fixes included. Use this one until Johnsa build and upload it on GIT and terrspace.
Cod-Father

LiaoMi

  • Member
  • ***
  • Posts: 287
Re: Symbol not defined
« Reply #12 on: June 29, 2018, 06:06:10 PM »
Hi LiaoMi
Did you have a problem with the "#if" hack? This could be important to know to understand a possible compatibility issue.

Biterider

Hi Biterider, habran, 

there are no problems, I was just worried about compatibility  :icon_rolleyes: this desire have no compelling reasons.

The release version of UASM.exe posted above is with fix for #if, affecting only if 0 and, which is safe and should be rejected with masm as well.
IF defined(SYMBOL) and (SYMBOL ge 1020) gets converted in first pass to IF 0 and (SYMBOL ge 1020) if SYMBOL is not defined and IF 1 and (SYMBOL ge 1020) if SYMBOL is defined.
There are some other small fixes included. Use this one until Johnsa build and upload it on GIT and terrspace.

Thanks for the explanation  :t

Biterider

  • Member
  • **
  • Posts: 222
  • ObjAsm32 - ObjAsm64
    • ObjAsm64
Re: Symbol not defined
« Reply #13 on: July 01, 2018, 06:10:04 PM »
Hi
Finally I found a workable solution. It's ugly, but it works on ML and the unmodified version of UASM.
As an example, the original translation of basetsd.h shows the following code section:
 
Code: [Select]
if (defined(__midl) and (501 lt __midl))
  INT_PTR typedef SDWORD
  …
else
  if defined(_WIN64)
    INT_PTR typedef QWORD
    …
  else
    INT_PTR typedef _W64
    …
  endif
endif

Now, as we know, if “__midl” is not defined, we have a problem on the first line, since the second condition is evaluated, regadles of the result of the first.
The solution is the split the “if” conditional sentence. In this case we will need 2 consecutive nested conditional sentences.
To restore the logic of the “else” clause, I introduce an additional symbol (??AND_xxx), that is only used for that purpose. To recycle it, it has to be resetted at the begining.
Now, it looks like:
 
Code: [Select]
??AND_001 = 0
if defined(__midl)
  if 501 lt __midl
    INT_PTR typedef SDWORD
    …
  else
    ??AND_001 = 1
  endif
else
  ??AND_001 = 1
endif
 
if ??AND_001 eq 1
  if defined(_WIN64)
    INT_PTR typedef QWORD
    …
  else
    INT_PTR typedef _W64
    …
  endif
endif

Regards, Biterider

LiaoMi

  • Member
  • ***
  • Posts: 287
Re: Symbol not defined
« Reply #14 on: July 01, 2018, 06:23:50 PM »
Hi Biterider,

brilliant solution  :t how did you come to this option ?! In this case, you can control the parameters as its done in cmake, a single list of such variables is required, I dont know if this list is needed at all  :biggrin: but such a macro implementation is very convenient  :eusa_clap: