1

我刚刚安装了Cosmos并尝试运行默认给出的测试程序。那是代码:

using System;
using System.Collections.Generic;
using System.Text;
using Sys = Cosmos.System;

namespace CosmosKernel2
{
    public class Kernel : Sys.Kernel
    {
        protected override void BeforeRun()
        {
            Console.WriteLine("Cosmos booted successfully. Type a line of text to get it echoed back.");
        }

        protected override void Run()
        {
            Console.Write("Input: ");
            var input = Console.ReadLine();
            Console.Write("Text typed: ");
            Console.WriteLine(input);
        }
    }
}

当我尝试编译它时,它说:

Error   8   Plug needed. System.Void  System.Threading.Monitor.Exit(System.Object)
   at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 663
   at Cosmos.IL2CPU.ILScanner.ScanQueue() in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 779
   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in c:\Data\Sources\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 284
   at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in c:\Data\Sources\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 239 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets    32  10  CosmosKernel2Boot

我正在使用 Visual Studio 2010,我已经安装了此处列出的所有要求:http: //cosmos.codeplex.com/releases/view/123476

先感谢您!

4

2 回答 2

1

“需要插入”错误意味着您使用了一些依赖于内部调用或 PInvoke 的方法,因此 Cosmos 无法编译它。

您可能使用了尚未插入的方法,或者可能缺少对该实现的引用(这使 Cosmos 认为它​​没有实现)

使用以下指南可帮助您入门:

http://www.codeproject.com/Articles/220076/Csharp-Open-Source-Managed-Operating-System-Intro

http://www.codeproject.com/Articles/29523/Cosmos-C-Open-Source-Managed-Operating-System

更新:尝试使用类似于此代码的内容:

using System;
using Cosmos.Compiler.Builder;

namespace CosmosBoot1
{
    class Program
    {
        #region Cosmos Builder logic
        // Most users wont touch this. This will call the Cosmos Build tool
        [STAThread]
        static void Main(string[] args)
        {
            BuildUI.Run();
        }
        #endregion

        // Main entry point of the kernel
        public static void Init()
        {
            var xBoot = new Cosmos.Sys.Boot();
            xBoot.Execute();
            //There's supposed to be a bit of text here. Change it to Console.WriteLine("Hello world!");
        }
    }
}
于 2015-04-19T19:37:44.640 回答
0

似乎 Cosmos 不适用于 Windows 8/8.1。因此,唯一的解决方案是安装 Windows 7 或运行安装了 Windows 7 的虚拟机(后者对我有用)

于 2015-05-01T08:30:22.897 回答