C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[19618] [만해] Template 사용법좀 갈켜 주세요~
만해 [greenuri] 763 읽음    2002-06-26 11:41
안녕하세요

만해입니다.

어제 드뎌 셤이 끝났네요

이제 이번주 중순부터 로비작업을 크크~

어제부터

이전에 만들었던 암호화를 한번 보완해 볼려고 작업 들어 갔는데요

template <typename T> T TCrypt::XOR ( T const Operand1, T const Operand2 , int const ByteLen)
{
T Dest;
  for ( int i = 0 ; i < ByteLen; i++ )
  {
     Dest.Bytes[i].bits.a = Operand1.Bytes[i].bits.a ^ Operand2.Bytes[i].bits.a;
     Dest.Bytes[i].bits.b = Operand1.Bytes[i].bits.b ^ Operand2.Bytes[i].bits.b;
     Dest.Bytes[i].bits.c = Operand1.Bytes[i].bits.c ^ Operand2.Bytes[i].bits.c;
     Dest.Bytes[i].bits.d = Operand1.Bytes[i].bits.d ^ Operand2.Bytes[i].bits.d;
     Dest.Bytes[i].bits.e = Operand1.Bytes[i].bits.e ^ Operand2.Bytes[i].bits.e;
     Dest.Bytes[i].bits.f = Operand1.Bytes[i].bits.f ^ Operand2.Bytes[i].bits.f;
     Dest.Bytes[i].bits.g = Operand1.Bytes[i].bits.g ^ Operand2.Bytes[i].bits.g;
     Dest.Bytes[i].bits.h = Operand1.Bytes[i].bits.h ^ Operand2.Bytes[i].bits.h;
  }
return Dest;
}

template <typename T>
T __fastcall XOR ( T const Operand1, T const Operand2 , int const ByteLen);

Data32Word_u __fastcall XOR ( Data32Word_u const  Operand1 , Data32Word_u const Operand2,
                              int const ByteLen)
    {
      return XOR<Data32Word_u>(Operand1, Operand2 , ByteLen);
    }

Data16Word_u __fastcall XOR ( Data16Word_u const  Operand1 , Data16Word_u const Operand2,
                              int const ByteLen)
    {
      return XOR<Data16Word_u>(Operand1, Operand2 , ByteLen);
    }
   
Data8Word_u  __fastcall XOR ( Data8Word_u const   Operand1 , Data8Word_u const  Operand2,
                              int const ByteLen)
    {
      return XOR<Data8Word_u>(Operand1, Operand2 , ByteLen);
    }


이렇게 되어 있는 소스가 있고

원래 템플릿이 아닌데 제가 한번 지정해 봤거든요

이렇게 하니깐

컴파일 단계에서는 에러가 안나는데

링크단계에서 에러가 나네요

[Linker Error] Unresolved external 'Data16Word__u TCrypt::XOR<Data16Word__u>(const Data16Word__u, const Data16Word__u, const int)' referenced from C:\PROGRAMMING\암호화\ENCRYPT.OBJ

[Linker Error] Unresolved external 'Data32Word__u TCrypt::XOR<Data32Word__u>(const Data32Word__u, const Data32Word__u, const int)' referenced from C:\PROGRAMMING\암호화\ENCODE.OBJ

[Linker Error] Unresolved external 'Data8Word__u TCrypt::XOR<Data8Word__u>(const Data8Word__u, const Data8Word__u, const int)' referenced from C:\PROGRAMMING\암호화\ENCODE.OBJ

+ -

관련 글 리스트
19618 [만해] Template 사용법좀 갈켜 주세요~ 만해 763 2002/06/26
19619     게시판은 하나만 사용합시다. 김백일 650 2002/06/26
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.