2012-08-06 1 views
2

예 : this 예를 들자면 Factorial 클래스를 확장하기로 결정했습니다.콘솔 인터페이스를 통해 컴파일러에 액세스하는 동안 라이브러리를 포함합니다.

using System; 
using System.Numerics; 

namespace Functions 
{ 
    public class Factorial 
    { 
     public static BigInteger CalcRecursively(int number) 
     { 
      if (number > 1) 
       return (BigInteger)number * CalcRecursively(number - 1); 
      if (number <= 1) 
       return 1; 

      return 0; 
     } 

     public static BigInteger Calc(int number) 
     { 
      BigInteger rValue=1; 

      for (int i = 0; i < number; i++) 
      { 
       rValue = rValue * (BigInteger)(number - i);     
      } 

      return rValue; 

     }  
    } 
} 

저는 기본적으로 포함되지 않은 System.Numerics를 사용했습니다. 따라서, 명령
csc /target:library /out:Functions.dll Factorial.cs DigitCounter.cs 출력 :

Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1 
Copyright (C) Microsoft Corporation. All rights reserved. 

Factorial.cs(2,14): error CS0234: The type or namespace name 'Numerics' does not 
     exist in the namespace 'System' (are you missing an assembly reference?) 
DigitCounter.cs(2,14): error CS0234: The type or namespace name 'Numerics' does 
     not exist in the namespace 'System' (are you missing an assembly 
     reference?) 
Factorial.cs(8,23): error CS0246: The type or namespace name 'BigInteger' could 
     not be found (are you missing a using directive or an assembly 
     reference?) 
Factorial.cs(18,23): error CS0246: The type or namespace name 'BigInteger' could 
     not be found (are you missing a using directive or an assembly 
     reference?) 
DigitCounter.cs(8,42): error CS0246: The type or namespace name 'BigInteger' 
     could not be found (are you missing a using directive or an assembly 
     reference?) 

OK. 어셈블리 참조가 누락되었습니다. "그것은 간단해야합니다. 전체 시스템에서 System.Numerics.dll 파일 두 개가 있어야합니다 - 내가 필요한 명령/링크 : [System.Numerics.dll의 x86 버전에 대한 경로]"를 추가하는 것입니다. 검색 결과가 내 영혼을 동결 시켰습니다. enter image description here

예상대로 많은 파일이 있습니다. 또한, 그들은 크기와 내용에 따라 다릅니다. 어느 것을 포함해야합니까? 두 개만 존재하는 이유는 무엇입니까?/link : 명령이 맞습니까? 아니면 내 사고 방식에 완전히 틀렸을 까?

답변

6

나는 일반적으로

/r:System.Numerics.dll 

를 사용하는 컴파일러 그냥 일반적으로 당신이 그것을 원하는 방법입니다 GAC에서 어셈블리를 찾을 수 있습니다 것으로 나타났습니다. (정확히 전일에 System.Numerics 콘솔 응용 프로그램이 필요했습니다.)

+0

csc의 명령 설명서 ('csc /?')에서 그런 유용한 명령이 언급되지 않은 것은 이상하지 않습니다. – 0x6B6F77616C74

+0

@kowalt : 그렇습니다. '/ r'은'/ reference'의 약식입니다. –

+0

나의 overshight. 어쨌든 접근 가능한 방식으로 설명해 주셔서 감사합니다. – 0x6B6F77616C74

관련 문제