Error a2005 symbol redefinition

Ошибка компиляции примера Iczelion'a tut17c.asm "Error A2005: symbol redefinition" Assembler, MASM32 Решение и ответ на вопрос 1691115
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
; masm dos com #
.386p
.model flat,stdcall
option casemap:none
;for WinXP - 498 bytes
include masm32includewindows.inc
include masm32includeuser32.inc
include masm32includekernel32.inc
includelib masm32libuser32.lib
includelib masm32libkernel32.lib
.data
.code
exebase equ 400000h
main:
include capito.asm
;----------------------------------
start:  xchg eax,ebx
    mov ebp,ebx
    invoke GetProcAddress,offset tut17a_dll+exebase
xchg eax,ecx
    jecxz a1
    mov edi,ecx  ; хэндл библиотеки (DLL)
        invoke GetProcAddress,ecx,offset aTestHello+exebase
inc ebp
        xchg eax,ecx
    jecxz a1
    mov TestHelloAddr+exebase,ecx
        call dword ptr TestHelloAddr+exebase
jmp a3
a1:     invoke MessageBox,ebx,[handle_message+ebp*4+exebase],offset aLoadLibrary+exebase,0
    dec ebp
    jnz a2
a3:     invoke FreeLibrary,edi
a2:     retn                        
;----------------------------------
aLoadLibrary db "Load Library",0
DllNotFound db "Cannot load library",0
FunctionNotFound db "TestHello function not found",0
handle_message dd DllNotFound+exebase,FunctionNotFound+exebase
tut17a_dll db "tut17a.dll",0
aTestHello db "TestHello",0
TestHelloAddr dd ?  ; адpес функции TestHello    
;----------------------------------
import: 
dd 0,0,0,user32_dll
dd user32_table
dd 0,0,0,kernel32_dll
dd kernel32_table
dd 0,0
user32_table:            
MessageBox      dd _MessageBox,0
kernel32_table:
LoadLibrary dd _LoadLibrary
GetProcAddress  dd _GetProcAddress
FreeLibrary dd _FreeLibrary
        dw 0
_MessageBox db 0,0,'MessageBoxA',0
user32_dll  db 'user32'
_FreeLibrary    db 0,0,'FreeLibrary'
_GetProcAddress db 0,0,'GetProcAddress'
_LoadLibrary    db 0,0,'LoadLibraryA',0
kernel32_dll    db 'kernel32'          
end_import:
end main

Topic: error A2005:symbol redefinition : movbe  (Read 19341 times)

In one of my routines I’m trying to use MOVBE
but MASM complains.

The two instructions where I use it are:

            movbe dword ptr [ebx], edx
            movbe dword ptr [eax], edi

and another strange error in REPEAT/ENDM [I think]:

Microsoft (R) Macro Assembler Version 10.00.30319.01
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: F:Esempi_PGMAssemblyTestReverse2.asm
F:Esempi_PGMAssemblyTestReverse2.asm(187) : error A2005:symbol redefinition : movbe
 MacroLoop(50): teration 1: Macro Called From
  F:Esempi_PGMAssemblyTestReverse2.asm(187): Main Line Code
F:Esempi_PGMAssemblyTestReverse2.asm(187) : error A2005:symbol redefinition : movbe
 MacroLoop(49): teration 2: Macro Called From
  F:Esempi_PGMAssemblyTestReverse2.asm(187): Main Line Code
F:Esempi_PGMAssemblyTestReverse2.asm(187) : error A2005:symbol redefinition : movbe
 MacroLoop(50): teration 2: Macro Called From
  F:Esempi_PGMAssemblyTestReverse2.asm(187): Main Line Code
F:Esempi_PGMAssemblyTestReverse2.asm(188) : error A2016:expression expected
 MacroLoop(49): teration 1: Macro Called From
  F:Esempi_PGMAssemblyTestReverse2.asm(188): Main Line Code
F:Esempi_PGMAssemblyTestReverse2.asm(188) : error A2138:invalid data initializer
 MacroLoop(49): teration 1: Macro Called From
  F:Esempi_PGMAssemblyTestReverse2.asm(188): Main Line Code
_
Assembly Error

If I change:

            movbe dword ptr [ebx], edx
            movbe dword ptr [eax], edi

with

            movbe [ebx], edx
            movbe [eax], edi

The first error goes away, but the second stays put.  ::)

What could it be.
Attached the complete prog.


Logged

There are only two days a year when you can’t do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama


movbe means CMOVBE? The conditional moves  can only have a register as destination (See the manuals!!!).


Logged

MREAL macros — when you need floating point arithmetic while assembling!


movbe means CMOVBE? The conditional moves  can only have a register as destination (See the manuals!!!).

Intel says:

Performs a byte swap operation on the data copied from the second operand (source
operand) and store the result in the first operand (destination operand). The source
operand can be a general-purpose register, or memory location; the destination
register can be a general-purpose register, or a memory location; however, both
operands can not be registers, and only one operand can be a memory location. Both
operands must be the same size, which can be a word, a doubleword or quadword.
The MOVBE instruction is provided for swapping the bytes on a read from memory or
on a write to memory; thus providing support for converting little-endian values to
big-endian format and vice versa.

It is not a conditional move, if I understand correctly.


Logged

There are only two days a year when you can’t do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama


Frank,

Two things, does your processor support that opcode AND does the MASM version you are using support that opcode ?


Logged



Logged

MREAL macros — when you need floating point arithmetic while assembling!


Frank,

Two things, does your processor support that opcode AND does the MASM version you are using support that opcode ?

Steve,

probably my CPU doesn’t, and the same for MASM , it complains.

A quick search shows that this instruction is only suppored by Intel’s Atom processors. Maybe not that usfull for common code.

http://software.intel.com/en-us/articles/disable-movbe-to-test-intel-atom-targeted-code-on-non-atom-platforms/

Later: the replacemnt is simply :

mov reg,data
bswap reg
mov dest,reg
Strange that they introduce a new instruction for that…

Thanks qWord, I thought the manuals were for all x86 CPUs.
I discovered it by chance and I was curious about its performance.


Logged

There are only two days a year when you can’t do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama


probably my CPU doesn’t, and the same for MASM , it complains.

ML version 11 support that instruction.


Logged

MREAL macros — when you need floating point arithmetic while assembling!


probably my CPU doesn’t, and the same for MASM , it complains.

ML version 11 support that instruction.

Good to know. If I’ll have an Atom CPU I’ll use it.


Logged

There are only two days a year when you can’t do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama


That’s because you have defined «product» twice: once as the name of memory location containing a BYTE, and (again, oops) as a «equate» with a specific «compile-time» value. That double definition simply isn’t allowed, but that has nothing to do with whether or how you can ask the assembler to accomplish a multiply.

The assembler can accomplish «multiply» for you two different ways:

  • at assembly-time (more generally, at the time you run the assembler), but only with constant values known at assembly-time
  • when your assembled program is executed, with arbitrary runtime values

In your example, you appear to be trying to do assembly-time multiplies. That will work fine if you don’t get tangled up in double-definitions. To fix your example, change it as follows:

...
main PROC
   product2 = 2*3*4*5
   mov bl, product2

   exit
main ENDP 

This should stop the double-definitions complaint. Alternatively, you could simply delete the line containing the BYTE declaration; it serves no useful purpose in this program.

However, I suspect that’s not what you really want to do. I’m guessing you are a student, and somebody wants you to write a program that multiplies at run time.

In that case, you’ll need to use a multiply instruction instead of an equate.

You can do that by writing the following:

          mul   <constant>

which multiplies EAX, at runtime, by a constant value defined at assembly-time. There are other variants of the MUL instruction that multiply by the runtime value of other registers or memory locations; as a student, you should go look this up to understand your choices. This brief discussion may help you understand why it is a little clumsy to use: Intel instruction set: multiply with EAX, EBX, ECX or EDX?. You should be reading the Intel reference manuals if you want useful detail on what the CPU can really do; since you mention «Irvine.32.inc» (my alma mater), I’d guess but don’t know that there is documentation related to Irvine32 and the related coursework that you better know. Welcome to studentville, and what the rest of your chosen career is likely to feel like («don’t know the topic? go find out»).

Since this appears to be homework, I’m leaving you with the above hint. You’ll need some more instructions (not much) to set up EAX with a value to be multiplied, and moving the answer to BL.

Hi all,

I am creating a checkerboard program in which the white tiles stay the same color but the colored tiles switch to each of the 16 4-bit colors after 500 ms. The following is the code that I have:

INCLUDE Irvine32.inc

SetColor PROTO forecolor:BYTE, backcolor: BYTE

WriteColorChar PROTO char:BYTE, forecolor:BYTE, backcolor:BYTE

PrintRowOdd PROTO color:BYTE

PrintRowEven PROTO color:BYTE

.data

rows = 8

columns = 8

color BYTE ?

.code

main PROC

mov ecx, 16

mov color,0

L1:

push ecx

mov ecx, rows/2

L2:

INVOKE PrintRowOdd, color

call Crlf

INVOKE PrintRowEven, color

call Crlf

loop L2

mov eax, 500

call Delay

inc color

pop ecx

loop L1

exit

main ENDP

PrintRowOdd PROC uses ecx, color:BYTE

mov ecx, columns / 2

L1:

INVOKE WriteColorChar, ‘ ‘, color, color

INVOKE WriteColorChar, ‘ ‘, color, color

INVOKE WriteColorChar, ‘ ‘, white, white

INVOKE WriteColorChar, ‘ ‘, white, white

loop L1

ret

PrintRowOdd ENDP

PrintRowEven PROC uses ecx, color:BYTE

mov ecx, columns / 2

L1:

INVOKE WriteColorChar, ‘ ‘, white, white

INVOKE WriteColorChar, ‘ ‘, white, white

INVOKE WriteColorChar, ‘ ‘, color, color

INVOKE WriteColorChar, ‘ ‘, color, color

loop L1

ret

PrintRowEven ENDP

WriteColorChar PROC USES eax, char:BYTE, forecolor:BYTE, backcolor:BYTE

INVOKE SetColor, forecolor, backcolor

mov al, char

call WriteChar

ret

WriteColorChar ENDP

SetColor PROC, forecolor:BYTE, backcolor:BYTE

movzx eax, backcolor

shl eax, 4

or al, forecolor

call SetTextColor ; from Irvine32.lib

ret

SetColor ENDP

END MAIN

And the error that I receive with this code is as such:

1>Checkers.asm(44):error A2005: symbol redefinition : color

1>Checkers.asm(44): error A2111: conflicting parameter definition

1>Checkers.asm(56): error A2005: symbol redefinition : color

1>Checkers.asm(56): error A2111: conflicting parameter definition

I think this error means that I am redefining a symbol (color) which needs to be constant. Any ideas on what I should do to resolve this?

Thanks in advance.

Error A2005 Symbol Redefinition

We have collected for you the most relevant information on Error A2005 Symbol Redefinition, as well as possible solutions to this problem. Take a look at the links provided and find the solution that works. Other people have encountered Error A2005 Symbol Redefinition before you, so use the ready-made solutions.

error A2005:symbol redefinition : movbe — MASM32

    http://masm32.com/board/index.php?topic=1020.0
    Dec 05, 2012 · error A2005:symbol redefinition : movbe. Performs a byte swap operation on the data copied from the second operand (source

masm32includewindows.inc(118) : error A2005: symbol .

    http://www.masm32.com/board/index.php?topic=1004.0
    Dec 03, 2012 · Should be: include masm32includewindows.inc ; windows.inc always goes 1st include masm32includemasm32.inc include masm32includekernel32.inc use «includelib» for lib filesincludelib masm32libmasm32.lib

symbol redefinition error — masmforum

    http://www.masmforum.com/board/index.php?topic=17230.0;prev_next=prev
    Aug 14, 2011 · well — those aren’t hard-and-fast rules it just helps the flow for example, you may reference an invoked function inside a macro, so we define prototypes first

ML Error Messages — untergrund.net

    http://in4k.untergrund.net/assembler%20distributions/masm32/ml.error.msgs.pdf
    A2005 symbol redefinition : identifier The given nonredefinable symbol was defined in two places. A2006 undefined symbol : identifier An attempt was made to use a symbol that was not defined. One of the following may have occurred: u A symbol was not defined. u A field was not a member of the specified structure.File Size: 109KB

[MASM/Assembly Language] Symbol Redefinition Error in .

    https://www.reddit.com/r/learnprogramming/comments/a53npg/masmassembly_language_symbol_redefinition_error/
    Google Tech Dev Guide is a curated collection of materials from many sources, including Google, that you can use to supplement your classwork or direct your own learning.. Excerpted from their website, «Whether you’re a student or an educator, newer to computer science or a more experienced coder, or otherwise interested in software engineering, we hope there’s …

Assembly private symbols redefinition error · Issue #27395 .

    https://github.com/rust-lang/rust/issues/27395
    I met the same problem, but #27395 (comment) get a error: invalid operand for instruction now. ( on Linux x64 ) ( on Linux x64 ) Finally I found out that adding $ <:uid>to …

A166: Error A25 (Symbol Redefinition)

    https://www.keil.com/support/docs/1719.htm
    Jan 13, 2021 · This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

masm — How do I multiply in assembly? — Stack Overflow

    https://stackoverflow.com/questions/25758615/how-do-i-multiply-in-assembly
    I’m about to pull my hair out for being stuck on such a trivial problem. I need to multiply 2 with 3 with 4 with 5 in one statement and store it in the bl register. My code so far is: TITLE PA2.

Compiling problems under Borland C++Builder 5 — Pico .

    https://www.picotech.com/support/topic704.html
    May 27, 2005 · If I comment these out it links and runs but doesn’t show a window and can only be shut down by ending the process. I also get a variable set but never used error, but I can live with that. I’m running on Windows XP. Any help would be greatly appreciated. Thanks! Nik

Error li1050 Multiply defined symbol in processor P0,in .

    https://ez.analog.com/dsp/software-and-development-tools/visualdsp/f/q-a/100324/error-li1050-multiply-defined-symbol-in-processor-p0-in-release-file-and-debug-file
    Jul 16, 2018 · This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Error A2005 Symbol Redefinition Fixes & Solutions

We are confident that the above descriptions of Error A2005 Symbol Redefinition and how to fix it will be useful to you. If you have another solution to Error A2005 Symbol Redefinition or some notes on the existing ways to solve it, then please drop us an email.

Источник

Error a2005 symbol redefinition

Welcome, Guest. Please login or register.
January 12, 2023, 06:56:56 AM

The MASM Forum Archive 2004 to 2012
General Forums
The Campus
symbol redefinition error
« previous next »
Pages: [1]
Author Topic: symbol redefinition error (Read 13837 times)
shaqywacky

New Member

Posts: 6

Hello everyone, I’m pretty new to assembler, so this might be really obvious.

Just as an exercise I tried to write a decimal to ascii converter but I keep getting this error: «/masm32/include/masm32.inc(402) : error A2005: symbol redefinition : RUN_SYNCH_PROCESS_EX». Obviously I can stop the error if I don’t include masm32.inc but I need it. Here’s the code:

.MODEL flat, stdcall

include /masm32/include/kernel32.inc
includelib /masm32/inc/kernel32.lib
include /masm32/include/masm32.inc
includelib /masm32/lib/masm32.lib

.DATA
number1 DWORD 7845
string1 BYTE 10 DUP(?),0

D1_dtoa PROTO :DWORD, :DWORD

start:
;invokes the main process
invoke D1_dtoa, number1, addr string1

;exits
invoke ExitProcess, 0
end start

D1_dtoa PROC num1:DWORD, dest1:DWORD
LOCAL num1 :DWORD
LOCAL dest1 :DWORD

;saves all the variables
push ebp
mov ebp, esp

push eax
push ebx
push ecx
push edx
push esi
push edi

;moves local variables into ebx and edi
mov ebx, num
mov edi, dest

;checks if it is negative or not, puts a minus sign if it is, a space if it isn’t
;This should save the sign bit and apply it at the end, I’ll fix this later
cmp ebx, 0
jge not_negative
mov edx, ‘-‘
mov [edi], edx
jmp negative
not_negative:
mov edx, ‘ ‘
mov [edi], edx
negative:
inc edi

;Divide by 10 and put remainder in the low part of the string
; end when ecx = 0 or eax = 0, quit
mov ecx, 9
.WHILE ecx > 0

mov edx, 10
mov eax, ebx
idiv edx
.IF eax == 0
.BREAK
.ENDIF
sub esi, ecx
mov [esi], edx
add esi, ecx
dec ecx
.ENDW

; fill in the rest with zeros. This is dumb and I’ll fix it later
mov edx, 0
.WHILE ecx > 0
sub esi, ecx
mov [esi], edx
add esi, ecx
dec ecx
.ENDW

pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
pop ebp

I know there are probably a lot of dumb things I did(like very little comments, and manually saving the registers), so if you see something that doesn’t have to do with main question but is bad assembly practice, feel free to tell me.

I tried changing all my variable names(that’s why they all have a number one in them) but that didn’t solve the problem.

I don’t know if it matters but I tired assembling with this command:

I’d really appricate some help.

Thanks

Logged

Gunner

Member

Gender:
Posts: 687

What the hell, why not.

Logged

Rob (Gunner)
— IE Zone Editor
— Gunners File Type Editor
http://www.gunnerinc.com

New Member

Posts: 6

Thanks, that fixed that problem.

Unfortunately there seem to be another one. When I try to link it I get this error: «d.obj : error LNK2001: unresolved external symbol _D1_dtoa@8».

Here’s the code with the changes:

.MODEL flat, stdcall
option casemap:none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
includelib /masm32/lib/kernel32.lib
include /masm32/include/masm32.inc
includelib /masm32/lib/masm32.lib

.DATA
number1 DWORD 7845
string1 BYTE 10 DUP(?),0

D1_dtoa PROTO :DWORD, :DWORD

start:
;invokes the main process
invoke D1_dtoa, number1, addr string1

;exits
invoke ExitProcess, 0
end start

D1_dtoa PROC num1:DWORD, dest1:DWORD
LOCAL num1 :DWORD
LOCAL dest1 :DWORD

;saves all the variables
push ebp
mov ebp, esp

push eax
push ebx
push ecx
push edx
push esi
push edi

;moves local variables into ebx and edi
mov ebx, num
mov edi, dest

;checks if it is negative or not, puts a minus sign if it is, a space if it isn’t
;This should save the sign bit and apply it at the end, I’ll fix this later
cmp ebx, 0
jge not_negative
mov edx, ‘-‘
mov [edi], edx
jmp negative
not_negative:
mov edx, ‘ ‘
mov [edi], edx
negative:
inc edi

;Divide by 10 and put remainder in the low part of the string
; end when ecx = 0 or eax = 0, quit
mov ecx, 9
.WHILE ecx > 0
mov edx, 10
mov eax, ebx
idiv edx
.IF eax == 0
.BREAK
.ENDIF
sub esi, ecx
mov [esi], edx
add esi, ecx
dec ecx
.ENDW

; fill in the rest with zeros. This is dumb and I’ll fix it later
mov edx, 0
.WHILE ecx > 0
sub esi, ecx
mov [esi], edx
add esi, ecx
dec ecx
.ENDW

; restore regisiters
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop eax
pop ebp

I’m thinking it has to do with how I’m invoking procedures, I haven’t done it a whole lot so I could easily be messing it up.

Logged

dedndave

Member

Posts: 12523

it is simpler to use the masm32rt.inc file for your preamble
as for the new error, you just need a prototype

get rid of all this stuff.

.MODEL flat, stdcall
option casemap:none

include /masm32/include/windows.inc
include /masm32/include/kernel32.inc
includelib /masm32/lib/kernel32.lib
include /masm32/include/masm32.inc
includelib /masm32/lib/masm32.lib

D1_dtoa PROTO :DWORD,:DWORD

Logged

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error a template declaration cannot appear at block scope
  • Error a system restart might be required before running the utility
  • Error a storage class can only be specified for objects and functions
  • Error a specified local key could not be updated from a keyserver
  • Error a redistributable package easyanticheat was not installed successfully

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии