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 ํ์ต.