일단 설명을 해드리자면
//--- inside of Gay.h
template <typename T>
T Gay(const T& t);
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
T Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
//---main.cpp
#include "Gay.h"
int main()
{
int b = Gay(5);
return 0;
}
하지만 이게 틀린이유는 Gay.h를 추가한다고 template T란 아는것은 아니기 떄문입니다.
그리고 이건 프로젝트 링크의 문재도 아닙니다. 그냥 main이 template T를 알지 못하기 때문이죠
이걸 고치려면
2가지 방법이있습니다.
a)
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
export Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
b)
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
inline Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
하는것이죠
어떤 컴파일러를 쓰냐에 따라 달려있지만 주로 b)를 쓰는것을 추천합니다. a)는 사용하는 컴파일러에 따라 서포팅을 안해줄수도 있기때문이죠ㅕ;.
//--- inside of Gay.h
template <typename T>
T Gay(const T& t);
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
T Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
//---main.cpp
#include "Gay.h"
int main()
{
int b = Gay(5);
return 0;
}
하지만 이게 틀린이유는 Gay.h를 추가한다고 template T란 아는것은 아니기 떄문입니다.
그리고 이건 프로젝트 링크의 문재도 아닙니다. 그냥 main이 template T를 알지 못하기 때문이죠
이걸 고치려면
2가지 방법이있습니다.
a)
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
export Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
b)
//--- Inside of Gay.cpp
include <iostream>
template <typename T>
inline Gay(const T& t)
{
cout << "I've come out this morning, my girlfriend was surprised the most"
}
하는것이죠
어떤 컴파일러를 쓰냐에 따라 달려있지만 주로 b)를 쓰는것을 추천합니다. a)는 사용하는 컴파일러에 따라 서포팅을 안해줄수도 있기때문이죠ㅕ;.
inline으로 해줘야 하나요? 그냥 헤더에 구현체 있으면 문제없는걸로 알고 있는데...?
그리고 CObjectPool을 사용하는 CTcpClient 헤더에 동시에 WRITE_BUFFER라는 구조체가 정의되 있어서 이것도 문제가 없어 보입니다만... 일단 inline으로 바꾸고 함 해보죠..
역시 안됩니다만;;;
바꿧다는것을 스크린샷 찍어서 올리고 잘못햇습빈다 10번쓰신후 다시보세요