Question

I am using VS2008 C++ (no libs). This is my code:

    __asm
    {
    jmp start
msg:
          db "http://www.stackoverflow.com"
dtfld:
          db "00/00/0000"
tmfld:
          db "00:00:00"
start:

I am getting the following errors:

Error 1 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
Error 2 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
Error 3 error C2400: inline assembler syntax error in 'opcode'; found 'bad token'

Why is this?

Was it helpful?

Solution

Quote from Data Directives and Operators in Inline Assembly (Microsoft):

Although an __asm block can reference C or C++ data types and objects, it cannot define data objects with MASM directives or operators. Specifically, you cannot use the definition directives DB, DW, DD, DQ, DT, and DF, or the operators DUP or THIS. MASM structures and records are also unavailable. The inline assembler doesn't accept the directives STRUC, RECORD, WIDTH, or MASK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top