Helllo again...
can anyone tell me why the assembler reports:
EXE.asm(74) : error A2042: statement too complex
when assembling this:
.386
.model flat, stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib
.data
MsgCaption db "WinAsm Template",0
MsgBoxText db "This is a bare bones exe application.",0
FORMAT_LENGTH EQU 100
.data?
MyObj struct
m_dw01 DD NULL ;001
m_dw02 DD NULL ;002
m_dw03 DD NULL ;003
m_dw04 DD NULL ;004
m_dw05 DD NULL ;005
m_dw06 DD NULL ;006
m_dw07 DD NULL ;007
m_dw08 DD NULL ;008
m_dw09 DD NULL ;009
m_dw10 DD NULL ;010
m_dw11 DD NULL ;011
m_dw12 DD NULL ;012
m_dw13 DD NULL ;013
m_dw14 DD NULL ;014
m_dw15 DD NULL ;015
m_dw16 DD NULL ;016
m_dw17 DD NULL ;017
m_dw18 DD NULL ;018
m_dw19 DD NULL ;019
m_dw20 DD NULL ;020
m_dw21 DD NULL ;021
m_dw22 DD NULL ;022
m_dw23 DD NULL ;023
m_dw24 DD NULL ;024
m_dw25 DD NULL ;025
m_dw26 DD NULL ;026
m_dw27 DD NULL ;027
m_dw28 DD NULL ;028
m_dw29 DD NULL ;029
m_bMyBool BOOL FALSE
m_dw30 DD NULL ;030
m_dw31 DD NULL ;031
m_dw32 DD NULL ;032
m_dw33 DD NULL ;033
m_dw34 DD NULL ;034
m_dw35 DD NULL ;035
m_dw36 DD NULL ;036
m_dw37 DD NULL ;037
m_dw38 DD NULL ;038
m_dw39 DD NULL ;039
m_Font LOGFONT <0,0,0,0,0,0,0,0,0,0,0,0,0,"MyFont">
m_str1 DB FORMAT_LENGTH DUP (0)
m_str2 DB FORMAT_LENGTH DUP (0)
MyObj ends
MyObjPTR TYPEDEF PTR MyObj
.data
g_MyObj MyObj { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , <0,0,0,0,0,0,0,0,0,0,0,0,0,"MyFont"> , "MyString1", "MyString2"}
.code
start:
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,NULL
end start
The error is reported on the line: g_MyObj MyObj { ... }
If I take out the 'm_Font LOGFONT' out of the structure everything works ok.
surely it not that complex? :'(
Hi,
First thing this isn't C. Now take a not of that ok :bdg . Anyway, while initializing a struct you should use < and > and not { and } change that to
g_MyObj MyObj < 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, FALSE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , <0,0,0,0,0,0,0,0,0,0,0,0,0,"MyFont"> , "MyString1", "MyString2">
and it should work. I haven't tried so I am not sure. try it out yourself
Thomas :U
I tired changing { } to < > but it still gave the same error. Too Complex!
Next suggestion please??
I am running outa ideas...please help!!
First define the struct with
g_MyObj MyObj <>
You can first ue memfil to fill it with 0's. Then use MemCopy , or szCopy to copy the sring sto the corresponding places in the srtucture.
Thomas :U
You would be more likely to get answers if you would format your code so it would reasonably fit into an editor. Having to scroll horizontally while counting characters is no fun.
.486 ; create 32 bit code
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
.data
MsgCaption db "WinAsm Template",0
MsgBoxText db "This is a bare bones exe application.",0
FORMAT_LENGTH EQU 100
.data?
MyObj struct
m_dw01 DD NULL ;001
m_dw02 DD NULL ;002
m_dw03 DD NULL ;003
m_dw04 DD NULL ;004
m_dw05 DD NULL ;005
m_dw06 DD NULL ;006
m_dw07 DD NULL ;007
m_dw08 DD NULL ;008
m_dw09 DD NULL ;009
m_dw10 DD NULL ;010
m_dw11 DD NULL ;011
m_dw12 DD NULL ;012
m_dw13 DD NULL ;013
m_dw14 DD NULL ;014
m_dw15 DD NULL ;015
m_dw16 DD NULL ;016
m_dw17 DD NULL ;017
m_dw18 DD NULL ;018
m_dw19 DD NULL ;019
m_dw20 DD NULL ;020
m_dw21 DD NULL ;021
m_dw22 DD NULL ;022
m_dw23 DD NULL ;023
m_dw24 DD NULL ;024
m_dw25 DD NULL ;025
m_dw26 DD NULL ;026
m_dw27 DD NULL ;027
m_dw28 DD NULL ;028
m_dw29 DD NULL ;029
m_bMyBool BOOL FALSE
m_dw30 DD NULL ;030
m_dw31 DD NULL ;031
m_dw32 DD NULL ;032
m_dw33 DD NULL ;033
m_dw34 DD NULL ;034
m_dw35 DD NULL ;035
m_dw36 DD NULL ;036
m_dw37 DD NULL ;037
m_dw38 DD NULL ;038
m_dw39 DD NULL ;039
;LOGFONTA STRUCT
; lfHeight DWORD ?
; lfWidth DWORD ?
; lfEscapement DWORD ?
; lfOrientation DWORD ?
; lfWeight DWORD ?
; lfItalic BYTE ?
; lfUnderline BYTE ?
; lfStrikeOut BYTE ?
; lfCharSet BYTE ?
; lfOutPrecision BYTE ?
; lfClipPrecision BYTE ?
; lfQuality BYTE ?
; lfPitchAndFamily BYTE ?
; lfFaceName BYTE LF_FACESIZE dup(?)
;LOGFONTA ENDS
; A string cannot initialize a field defined with dup(?) :
;m_Font LOGFONT <0,0,0,0,0,0,0,0,0,0,0,0,0,"MyFont">
m_Font LOGFONT <0,0,0,0,0,0,0,0,0,0,0,0,0>
m_str1 DB FORMAT_LENGTH DUP (0)
m_str2 DB FORMAT_LENGTH DUP (0)
MyObj ends
MyObjPTR TYPEDEF PTR MyObj
.data
;g_MyObj MyObj <> ; This will work, using default initializers
g_MyObj MyObj <0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
FALSE,\
0,0,0,0,0,0,0,0,0,0,\
{0,0,0,0,0,0,0,0}> ; Max initializers before statement too complex
; Remaining fields will have default values
.code
start:
invoke MessageBox, NULL,addr MsgBoxText, addr MsgCaption, MB_OK
invoke ExitProcess,NULL
end start