Invalid character (0xe2) in mnemonic

天大地大妈咪最大 提交于 2021-01-28 02:02:47

问题


I have trouble compiling my assembly code.

gcc returns: func_select.s:5: Error: invalid character (0xe2) in mnemonic func_select.s:7: Error: invalid character (0xe2) in mnemonic

here is the code (lines 5-7):

secondStringLength:     ‫‪.string " second pstring length: %d‬‬\n"
OldChar:                .string "‫‪old char: %c,‬‬"
NewChar:                ‫‪.string " new char: %c,‬‬"

How can I fix this?


回答1:


Remove the formatting characters embedded in the text.

$ charinfo 'secondStringLength:‫‪.string " second pstring length: %d‬‬\n"'
U+0073 LATIN SMALL LETTER S [Ll]
U+0065 LATIN SMALL LETTER E [Ll]
 ...
U+0068 LATIN SMALL LETTER H [Ll]
U+003A COLON [Po]
U+202B RIGHT-TO-LEFT EMBEDDING [Cf]
U+202A LEFT-TO-RIGHT EMBEDDING [Cf]
U+002E FULL STOP [Po]
U+0073 LATIN SMALL LETTER S [Ll]
 ...
U+0025 PERCENT SIGN [Po]
U+0064 LATIN SMALL LETTER D [Ll]
U+202C POP DIRECTIONAL FORMATTING [Cf]
U+202C POP DIRECTIONAL FORMATTING [Cf]
U+005C REVERSE SOLIDUS [Po]
U+006E LATIN SMALL LETTER N [Ll]
U+0022 QUOTATION MARK [Po]



回答2:


Igancio Vazquez-Abrams is right. To provide more detail, according to xxd this is your first line:

$ cat b | xxd
00000000: 7365 636f 6e64 5374 7269 6e67 4c65 6e67  secondStringLeng
00000010: 7468 3a20 2020 2020 e280 abe2 80aa 2e73  th:     .......s
00000020: 7472 696e 6720 2220 7365 636f 6e64 2070  tring " second p
00000030: 7374 7269 6e67 206c 656e 6774 683a 2025  string length: %
00000040: 64e2 80ac e280 ac5c 6e22 0a0a            d......\n"..

Note: e2 80 ab and then e2 80 aa. These are the U+202B and U+202A mentioned earlier. Remove them (as well as the next 2 U+202C).



来源:https://stackoverflow.com/questions/34283126/invalid-character-0xe2-in-mnemonic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!