您好,我不明白这些"未定义"错误和"没有时间"



所以,我不喜欢用C#进行编码,但我使用了unity,它使用C#。我们得到所有这些错误:

Compilation error (line 8, col 6): } expected
Compilation error (line 13, col 33): Empty character literal
Compilation error (line 21, col 9): Invalid token 'while' in class, record, struct, or interface member declaration
Compilation error (line 21, col 16): Type expected
Compilation error (line 21, col 16): Tuple must contain at least two elements.
Compilation error (line 21, col 16): ) expected
Compilation error (line 21, col 16): Invalid token 'true' in class, record, struct, or interface member declaration
Compilation error (line 23, col 17): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 23, col 17): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 23, col 29): Invalid token '(' in class, record, struct, or interface member declaration
Compilation error (line 23, col 30): Tuple must contain at least two elements.
Compilation error (line 23, col 31): Invalid token ';' in class, record, struct, or interface member declaration
Compilation error (line 25, col 23): Type expected
Compilation error (line 25, col 23): Syntax error, ',' expected
Compilation error (line 26, col 22): Syntax error, '>' expected
Compilation error (line 26, col 22): Tuple must contain at least two elements.
Compilation error (line 26, col 22): ) expected
Compilation error (line 26, col 22): Invalid token ';' in class, record, struct, or interface member declaration
Compilation error (line 27, col 16): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 27, col 16): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 27, col 23): Tuple must contain at least two elements.
Compilation error (line 28, col 26): Invalid token '(' in class, record, struct, or interface member declaration
Compilation error (line 28, col 29): Tuple must contain at least two elements.
Compilation error (line 28, col 30): Invalid token ';' in class, record, struct, or interface member declaration
Compilation error (line 29, col 20): Tuple must contain at least two elements.
Compilation error (line 29, col 20): ) expected
Compilation error (line 29, col 20): Invalid token '!=' in class, record, struct, or interface member declaration
Compilation error (line 31, col 20): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 31, col 20): Invalid token '=' in class, record, struct, or interface member declaration
Compilation error (line 31, col 32): Identifier expected
Compilation error (line 31, col 36): Identifier expected
Compilation error (line 35, col 1): Top-level statements must precede namespace and type declarations.
Compilation error (line 34, col 14): 'else' cannot start a statement.
Compilation error (line 34, col 14): Syntax error, '(' expected
Compilation error (line 34, col 14): Invalid expression term 'else'
Compilation error (line 34, col 14): ) expected
Compilation error (line 34, col 14): Invalid expression term 'else'
Compilation error (line 34, col 14): ; expected
Compilation error (line 67, col 9): Type or namespace definition, or end-of-file expected
Compilation error (line 69, col 5): Type or namespace definition, or end-of-file expected
Compilation error (line 70, col 1): Type or namespace definition, or end-of-file expected
Compilation error (line 31, col 22): Method must have a return type
Compilation error (line 31, col 22): 'Demo.Demo(all, ch)' must declare a body because it is not marked abstract, extern, or partial
Compilation error (line 31, col 29): The type or namespace name 'all' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 31, col 34): The type or namespace name 'ch' could not be found (are you missing a using directive or an assembly reference?)
Compilation error (line 27, col 24): The type 'Demo' already contains a definition for 'val'
Compilation error (line 7, col 17): The entry point of the program is global code; ignoring 'Demo.Main()' entry point.
Compilation error (line 37, col 17): The name 'cmd' does not exist in the current context
Compilation error (line 37, col 23): The name 'all' does not exist in the current context
Compilation error (line 38, col 17): The name 'all' does not exist in the current context
Compilation error (line 39, col 17): The name 'all' does not exist in the current context
Compilation error (line 39, col 23): The name 'Concat' does not exist in the current context
Compilation error (line 39, col 30): The name 'all' does not exist in the current context
Compilation error (line 39, col 35): The name 'ch' does not exist in the current context
Compilation error (line 42, col 17): The name 'ch' does not exist in the current context
Compilation error (line 44, col 21): The name 'cmd' does not exist in the current context
Compilation error (line 46, col 38): The name 'path2' does not exist in the current context
Compilation error (line 48, col 67): The name 'path2' does not exist in the current context
Compilation error (line 19, col 14): The field 'Demo.ch' is never used
Compilation error (line 27, col 24): The field 'Demo.val' is never used
Compilation error (line 14, col 24): The field 'Demo.all' is assigned but its value is never used
Compilation error (line 15, col 24): The field 'Demo.cmd' is assigned but its value is never used
Compilation error (line 18, col 13): The field 'Demo.val' is assigned but its value is never used

这是我的源代码:

using System;
using System.IO;
using System.Text;
class Demo
{
static void Main()
{
public string path = @"SCRIPT.vis";
public string path2 = @"header.asm";

private char previous = '';
private string all = "";
private string cmd = "";

Stream s = new FileStream(@"data.vi", FileMode.Open);
int val = 0;
char ch;
while (true)
{
val = s.ReadByte();
if (val < 0)
break;
ch = (char)val;
Console.Write(ch);
if (ch != "(")
{
all = Concat(all, ch);


}
else
{
cmd = all;
all = "";
all = Concat(all, ch);

}
if (ch == ")")
{
if (cmd == "os.Start")
{
if (!File.Exists(path2))
{
using (StreamWriter sw = File.CreateText(path2))
{
sw.WriteLine("section .multiboot_header");
sw.WriteLine("header_start:");
sw.WriteLine("     dd 0xe85250d6");
sw.WriteLine("     dd 0");
sw.WriteLine("     dd header_end - header_start");
sw.WriteLine("     dd 0x100000000 - (0xe85250d6 + 0 + (header_end - header_start))");
sw.WriteLine("     ");
sw.WriteLine("     dw 0");
sw.WriteLine("     dw 0");
sw.WriteLine("     dd 8");
sw.WriteLine("header_end:");

}    
}    
}    
}    
}
Console.WriteLine();
}
}

所以,谢谢你的帮助!顺便说一句,这是为一个编译器的东西。此外,如果出于某种原因您需要此我正在在线编译器DOTNETFIDDLE上运行(很好地测试错误(我的代码。

public string path = @"SCRIPT.vis";
public string path2 = @"header.asm";

private char previous = '';
private string all = "";
private string cmd = "";

应该是

string path = @"SCRIPT.vis";
string path2 = @"header.asm";

char previous = '';
string all = "";
string cmd = "";

也因为ch是一个字符,所以这个

if (ch != "(")

应该是

if (ch != '(')

最新更新