News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Symbol not defined

Started by Biterider, June 20, 2018, 05:26:34 AM

Previous topic - Next topic

Biterider

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

Can you provide a source file which is causing that error?
Cod-Father

Biterider

Hi Habran
I will prepare a test case by this weekend.
Biterider

habran

Cod-Father

Biterider

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

Keep up good job :t
Are you using the modified exe or normal one?
Try to switch them.
Cod-Father

HSE

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. 
Equations in Assembly: SmplMath

habran

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

Hi
Perfect, the bug is gone  :eusa_dance:
Thanks everybody!

Biterider

LiaoMi

Quote from: habran 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.

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

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

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

Quote from: Biterider 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

Hi Biterider, habran, 

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

Quote from: habran 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.

Thanks for the explanation  :t

Biterider

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:

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:

??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

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: