[已解決] Static Library Project 的 MFC 不支援 template

最近為了用 Unit Test 而將一些程式碼放在 Static Library Project 中,但在使用 CArray template 時卻出現

Compiler error C2976: 'CArray' : too few template arguments


經比對一般的 MFC Project 才發現 stdafx.h 未加入

#include <afxtempl.h>

加入後就一切正常了



Test project 也要加入,而且設定使用 Shared DLL MFC 才能正常測試

留言

這個網誌中的熱門文章

Linux 批次檔的寫法

【分享】如何顯示 Debug Message

[分享] Visual Studio 遠端偵錯