error A2008: syntax error : . in the .asm file

error A2008: syntax error : . in the .asm file

hi,

let me first give a little background of what i am trying to acheive before ithrow my query.

i wrote a small helloworld.cpp file in microsoft visual studio.netand then compiled this file to get a helloworld.asm file.

However i found that the microsoft visual studio.net ignores the .asm file and compiles and runs only .cpp file.

for microsft Visual studio to consider my .asm file, i right clicked on the .asm file and in the properties>custom build setup>
I entered the following
Command line: c:masm32inml /c /Cx /coff .Debughelloworld.asm
Outputs : $(InputName).obj

Now when i click on the build icon, the compiler gives a syntax error in the .asm file.
Assembling: .DebugHelloworld.asm
.DebugHelloworld.asm(55) : error A2008: syntax error : .
.DebugHelloworld.asm(59) : error A2008: syntax error : .
Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"

The code on line 55 and 59 is a as follows

__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase

__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown

Can anyone help me understand what this error is and how i can get rid of it.

Thanks in advance

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Dear Shippi,

I don't have a windows compiler to try this out and it's unclear if you are using the MS compiler or icl to compile from .cpp to .asm.

From the symbols shown that seem to cause the error, here's a guess - RTC = run time check. Do you have options on the command line to specify some run time checks? Maybe if you turn those options off, you may have better results. Just a guess for now.

As an aside, our compiler does not make the explicit promise that code compiled to asm can be assembled into an object file. It's more of a 'for your reference' listing.

Regards,

Max

hey Max

thanks for the help.

I am using MS compiler to compile from .cpp to .asm.

As per your suggestion i turned the RTC option off and now it doesnt show this error .....BUT now it shows a new error to me

Compiling...
test.cpp
Linking...

test.obj : error LNK2005: "`string'" (??_C@_0M@LACCCNMM@hello?5world?$AA@) already defined in test.obj

test.obj : error LNK2005: _main already defined in test.obj

Debug/test.exe : fatal error LNK1169: one or more multiply defined symbols found

i am pasting my small test.cpp code and the .asm generated

test.cpp

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])

{

printf("hello world");

return 0;

}

test.asm

; Listing generated by Microsoft Optimizing Compiler Version 13.10.3077

TITLE . est.cpp

.386P

include listing.inc

if @Version gt 510

.model FLAT

else

_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'

_TEXT ENDS

_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'

_DATA ENDS

CONST SEGMENT DWORD USE32 PUBLIC 'CONST'

CONST ENDS

_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'

_BSS ENDS

$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'

$$SYMBOLS ENDS

$$TYPES SEGMENT BYTE USE32 'DEBTYP'

$$TYPES ENDS

_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'

_TLS ENDS

; COMDAT ??_C@_0M@LACCCNMM@hello?5world?$AA@

CONST SEGMENT DWORD USE32 PUBLIC 'CONST'

CONST ENDS

xdata$x SEGMENT DWORD USE32 PUBLIC 'CONST'

xdata$x ENDS

; COMDAT _main

_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'

_TEXT ENDS

; COMDAT ?_Psave@?$_Facetptr@V?$ctype@G@std@@@std@@2PBVfacet@locale@2@B

_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'

_DATA ENDS

; COMDAT ?_Psave@?$_Facetptr@V?$ctype@D@std@@@std@@2PBVfacet@locale@2@B

_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'

_DATA ENDS

sxdata SEGMENT DWORD USE32 'SXDATA'

sxdata ENDS

FLAT GROUP _DATA, CONST, _BSS

ASSUME CS: FLAT, DS: FLAT, SS: FLAT

endif

INCLUDELIB LIBCD

INCLUDELIB OLDNAMES

PUBLIC _main

PUBLIC ??_C@_0M@LACCCNMM@hello?5world?$AA@ ; `string'

EXTRN _printf:NEAR

; COMDAT ??_C@_0M@LACCCNMM@hello?5world?$AA@

; File c:documents and settingssdesaimy documentsvisual studio projects est est.cpp

CONST SEGMENT

??_C@_0M@LACCCNMM@hello?5world?$AA@ DB 'hello world', 00H ; `string'

; Function compile flags: /Odt /ZI

CONST ENDS

; COMDAT _main

_TEXT SEGMENT

_argc$ = 8 ; size = 4

_argv$ = 12 ; size = 4

_main PROC NEAR ; COMDAT

; Line 7

push ebp

mov ebp, esp

sub esp, 64 ; 00000040H

push ebx

push esi

push edi

; Line 8

push OFFSET FLAT:??_C@_0M@LACCCNMM@hello?5world?$AA@

call _printf

add esp, 4

; Line 9

xor eax, eax

; Line 10

pop edi

pop esi

pop ebx

mov esp, ebp

pop ebp

ret 0

_main ENDP<
/P>

_TEXT ENDS

END

thanks in advance for your help

Shippi

Dear Shippi,

Have you tried the process with the Intel compiler instead of the MS compiler? Any better results?

What if you deleted the offending symbol from the .asm file?

Max

hey

finally got the .asm file working... phew!!!

I went in to project>properties>c/c++>code generation ... and set the basic runtime checks field as default. This took care of the _RTC errors.

It then showed me error stating that _main already exist in the test.obj. It then struck to me that this error is because both test.cpp as well as test.asm existed in the workspace at the same time so VC++ was confused about which main function to use. So before building and running the test.asm, I removed the test.cpp file from the workspace and now the test.asm file works fine and also reflect all the changes made to it.

Shilpa

Dear Shippi,

Glad to see you got it working.

Regards,

Max

Leave a Comment

Please sign in to add a comment. Not a member? Join today