Error C2400
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the syntax error assembly company Business Learn more about hiring developers or posting ads with us Stack Overflow
Visual Studio Error 2400
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7
Vc++ C2400
million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Compiler Error in inline Assembly error:- C2400: inline assembler syntax error in 'second operand'; found 'newline' up vote 6
Error C2440
down vote favorite I was testing some C code and came across this strange compiler error The following code would not compile #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the error c2400 inline assembler syntax error in opcode found company Business Learn more about hiring developers or posting ads with us Stack Overflow inline assembler syntax error in opcode found eax Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 c2400 f5 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Inserting a comment in __asm results in C2400 error (VS2012) up vote 1 down vote favorite I was trying http://stackoverflow.com/questions/20054124/compiler-error-in-inline-assembly-error-c2400-inline-assembler-syntax-error-i to check the compiled assembler of some code in VS 2012. I added two lines (before and after my code) as such: __asm ; it begins here! // My code __asm ; it ends here! However, VS didn't like that. I got error C2400: inline assembler syntax error in 'opcode'; found 'bad token' So I added a NOP, which I didn't want to: __asm NOP ; Comment! That worked fine. My question is http://stackoverflow.com/questions/31262349/inserting-a-comment-in-asm-results-in-c2400-error-vs2012 twofold. Why didn't VS allow me to add an assembly comment? Is there a different way to add an assembly comment without adding an instruction, including NOP? c++ visual-studio assembly share|improve this question edited Jul 7 '15 at 10:23 asked Jul 7 '15 at 7:28 Avi Ginsburg 4,1603828 __asm { / // Comment / } also didn't work? Does this always happen when you place comments on a line of their own, or only if there are no instructions at all in the __asm block? –Michael Jul 7 '15 at 7:47 Your suggestion doesn't work (I think the comment and } is parsed as a C++ comment). As I wrote in the question, __asm NOP ; Comment! works. The problem is just when there is no instruction. –Avi Ginsburg Jul 7 '15 at 7:51 The slashes between the code-formatted blocks in my comment represents newlines, so it wasn't all meant to go on a single line. But perhaps you got that. –Michael Jul 7 '15 at 7:54 1 Oh, you wanted those comments to be present in the assembly output from the compiler? Nevermind then. –Michael Jul 7 '15 at 7:57 If you want the comments to appear in the assembly it doesn't matter what format
here for a quick overview of the site Help Center Detailed answers to any questions you might have http://stackoverflow.com/questions/5062488/error-c2400-inline-assembler-syntax-error-in-second-operand-found-register Meta Discuss the workings and policies of this site About Us http://www.dreamincode.net/forums/topic/325042-how-to-use-asm-inside-c-win32/ Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just syntax error like you, helping each other. Join them; it only takes a minute: Sign up error C2400: inline assembler syntax error in 'second operand'; found 'register' up vote 1 down vote favorite 1 I am facing compilation error while working with assembly instructions in VC++ as MACRO inline based assembler blocks. error C2400: inline assembler syntax error inline assembler syntax in 'second operand'; found 'register' Here is the code: _asm {\ mov esi,dword ptr [pMemBlock]\ sub esp,sizeOfblock\ mov ebx,sizeOfblock\ mov shrResult,ebx\ shr shrResult,2\ mov ecx,shrResult\ mov shrResult,0\ mov edi,esp\ rep movs dword ptr es:[edi],dword ptr[esi]\ } Regards Usman c++ visual-studio-2010 assembly inline-assembly share|improve this question edited Feb 21 '11 at 5:19 templatetypedef 199k44496753 asked Feb 21 '11 at 5:01 Usman 67821545 @GMan : Thnaks , it worked! –Usman Feb 21 '11 at 7:25 @Muhammad: Great. :) I'll add my comment as an answer. –GManNickG Feb 21 '11 at 7:28 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted That blank line after the _asm { line will complete the macro. It should be deleted or have \ on it. share|improve this answer answered Feb 21 '11 at 7:28 GManNickG 231k29346470 add a comment| up vote 2 down vote It should be _asm {\ __asm mov esi,dword ptr [pMemBlock]\ __asm sub esp,sizeOfblock\ ... See this msdn pag
New Topic/Question Reply 2 Replies - 5655 Views - Last Post: 19 July 2013 - 02:25 AM Rate Topic: #1 DocNet D.I.C Head Reputation: 0 Posts: 118 Joined: 11-October 12 How to use ASM inside C++ Win32? Posted 18 July 2013 - 07:00 AM Hi, I'm new in Win32 C++ and Assembler too, I'm trying to call MessageBox using Assembler inside C++ Win32 code on button click. For now first problem is with asm code, why he showserrors, and I have these errors: Error 1 error C2400: inline assembler syntax error in 'opcode'; found 'constant' Error 2 error C2400: inline assembler syntax error in 'opcode'; found 'model' Error 3 error C2400: inline assembler syntax error in 'opcode'; found 'casemap' Error 4 error C2400: inline assembler syntax error in 'opcode'; found 'MessageBoxA' Error 5 error C2400: inline assembler syntax error in 'opcode'; found 'ExitProcess' Error 6 error C2400: inline assembler syntax error in 'opcode'; found 'data' Error 7 error C2400: inline assembler syntax error in 'opcode'; found 'db' Error 8 error C2400: inline assembler syntax error in 'opcode'; found 'db' Error 9 error C2400: inline assembler syntax error in 'opcode'; found 'code' Error 10 error C2400: inline assembler syntax error in 'opcode'; found 'MessageBoxA' Error 11 error C2400: inline assembler syntax error in 'opcode'; found 'constant' Error 12 error C2400: inline assembler syntax error in 'opcode'; found 'MsgBoxText' Error 13 error C2400: inline assembler syntax error in 'opcode'; found 'MsgBoxCaption' Error 14 error C2400: inline assembler syntax error in 'opcode'; found 'constant' Error 15 error C2400: inline assembler syntax error in 'opcode'; found 'ExitProcess' Error 16 error C2400: inline assembler syntax error in 'opcode'; found 'start' Main full code: // Win32 Vezba02.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "Win32 Vezba02.h" #define MAX_LOADSTRING 100 #define IDC_