KO CSharp Directive Error - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

ะฃะบั€ะฐั—ะฝััŒะบะฐ ยท ะ ัƒััะบะธะน ยท English ยท Deutsch ยท Franรงais ยท Italiano ยท Espaรฑol ยท ็น้ซ”ไธญๆ–‡ ยท ๆ—ฅๆœฌ่ชž ยท ํ•œ๊ตญ์–ด

๋ช…๋ฐฑํ•œ ์ปดํŒŒ์ผ ์˜ค๋ฅ˜

ํ•ธ๋“œ๋ถ C# ยท ์‹ค์šฉ ๊ฐ€์ด๋“œ

์ง€์‹œ๋ฌธ์ด ํ™œ์„ฑ ๋ถ„๊ธฐ์— ์†ํ•˜๋Š” ๊ฒฝ์šฐ ์ž‘์„ฑ์ž ์˜ค๋ฅ˜๋กœ ์ปดํŒŒ์ผ์„ ์ค‘์ง€ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์‹œ๋Š” ์˜๋„์ ์ธ ๊ฑฐ๋ถ€ ์กฐ๊ฑด์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

๊ฐ„๋‹จํ•œ ์˜ˆ์ œ (Example.cs)

์ด ์˜ˆ์ œ๋ฅผ Example.cs๋กœ ๋”ฐ๋กœ ์ €์žฅํ•˜๊ณ  ์ด ํŽ˜์ด์ง€์˜ ๋‹ค๋ฅธ ์˜ˆ์ œ์™€ ๋…๋ฆฝ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์„ธ์š”.

Example.cs:

// PROJECT-EXAMPLE
#define CONFIGURED
#if !CONFIGURED
#error Missing configuration
#endif
System.Console.WriteLine("Configured");

์ด ์˜ˆ์ œ๋Š” ์ปดํŒŒ์ผ๋ฉ๋‹ˆ๋‹ค. CONFIGURED๊ฐ€ ์ •์˜๋˜์–ด #error ๋ถ„๊ธฐ๊ฐ€ ๋น„ํ™œ์„ฑํ™”๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜์˜ ์˜๋„์ ์œผ๋กœ ์‹คํŒจํ•˜๋Š” ์˜ˆ์ œ๋Š” ๊ณ„์† ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

๊ฒฐ๊ณผ:

Configured

ํ†ต์‚ฌ๋ก 

#error message

์ด๋Ÿฌํ•œ ์˜ˆ์ œ๋Š” ์˜๋„์ ์œผ๋กœ ์ปดํŒŒ์ผ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์›ํ•˜๋Š” ๊ตฌ์„ฑ์„ ์„ค์ •ํ•œ ํ›„ ๋ฒ„๊ทธ๋ฅผ ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜ ๋น„ํ™œ์„ฑ ๋ถ„๊ธฐ๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

์ƒํƒœ: ๊ณ ์˜์ ์ธ ์ปดํŒŒ์ผ ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค.

์˜ˆ์‹œ 1

#error Missing required configuration
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        Console.WriteLine("Never reached");
    }
}

์˜ˆ์‹œ 2

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;

public static class Program
{
    public static async Task Main(string[] args)
    {
        #if !CONFIGURED
        #error Define CONFIGURED before compiling
        #endif
        Console.WriteLine("Configured");
    }
}

๊ณต์‹ ์ถœ์ฒ˜: Microsoft ํ•™์Šต.