3
namespace CosmosKernel2
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
           Console.WriteLine("hi.");
        }
        protected override void Run()
        {
            Console.WriteLine("Input:");
            String input = Console.ReadLine();
        if (input.StartsWith("echo"))
            {
               var index = input.LastIndexOf(input);  // ERROR HERE
               Console.WriteLine("echo: " + input.Substring(cmdLastIndex));
            }}}}

ユーザーの入力をエコーする単純な OS を作成しています。ただし、いくつかのエラーが発生しています。var インデックスを作成し、最後のインデックスを保存することに問題はありません。

これが私のエラーです:

 Build started: Project: CosmosKernel2Boot, Configuration: Debug x86 ------
1>  Invoking il2cpu.exe "DebugEnabled:True" "StackCorruptionDetectionEnabled:False" "DebugMode:Source" "TraceAssemblies:" "DebugCom:1" "UseNAsm:True" "OutputFilename:C:\Users\Lindsay\Documents\Visual Studio 2015\Projects\CosmosKernel2\CosmosKernel2\bin\Debug\CosmosKernel2Boot.asm" "EnableLogging:True" "EmitDebugSymbols:True" "IgnoreDebugStubAttribute:False" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.Core.Plugs.dll" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.Debug.Kernel.Plugs.dll" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.System.Plugs.dll" "References:C:\Users\Lindsay\Documents\Visual Studio 2015\Projects\CosmosKernel2\CosmosKernel2\bin\Debug\CosmosKernel2.dll" "References:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" 
1>C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets(31,5): error : Error occurred while invoking IL2CPU.
1>  Executing command line "C:\Users\Lindsay\Downloads\Cosmos User Kit\Build\IL2CPU\IL2CPU.exe" "DebugEnabled:True" "StackCorruptionDetectionEnabled:False" "DebugMode:Source" "TraceAssemblies:" "DebugCom:1" "UseNAsm:True" "OutputFilename:C:\Users\Lindsay\Documents\Visual Studio 2015\Projects\CosmosKernel2\CosmosKernel2\bin\Debug\CosmosKernel2Boot.asm" "EnableLogging:True" "EmitDebugSymbols:True" "IgnoreDebugStubAttribute:False" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.Core.Plugs.dll" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.Debug.Kernel.Plugs.dll" "References:C:\Users\Lindsay\Downloads\Cosmos User Kit\Kernel\Cosmos.System.Plugs.dll" "References:C:\Users\Lindsay\Documents\Visual Studio 2015\Projects\CosmosKernel2\CosmosKernel2\bin\Debug\CosmosKernel2.dll" "References:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Core.dll" 
1>  Working directory = 'C:\Users\Lindsay\Documents\Visual Studio 2015\Projects\CosmosKernel2\CosmosKernel2\bin\Debug\'
4

1 に答える 1

0

undefined variable を参照しているようですcmdLastIndex。に名前を変更する必要がありindexます。

Console.WriteLine("echo: " + input.Substring(cmdLastIndex));
于 2016-10-26T02:13:29.973 に答える