Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print 函数打印模版特化问题 #26

Closed
jr981008 opened this issue Oct 11, 2023 · 2 comments
Closed

print 函数打印模版特化问题 #26

jr981008 opened this issue Oct 11, 2023 · 2 comments

Comments

@jr981008
Copy link

jr981008 commented Oct 11, 2023

#include "print.h"
template<typename T>
class TypeToID{
public:
    static int const  ID=-1;
};
template<> class TypeToID<void*>{
public:
   static  int const  ID=1;
};
int main(){


    print(TypeToID<void *>::ID);

    return 0;

}

链接报错 找不到符号
.rdata$.refptr._ZN8TypeToIDIPvE2IDE[.refptr._ZN8TypeToIDIPvE2IDE]+0x0): undefined reference to `TypeToID<void*>::ID'

@archibate
Copy link
Collaborator

archibate commented Oct 11, 2023 via email

@jr981008
Copy link
Author

妙enum { ID = 1; }
感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants