我想问一下如何在不同的编译单元中从stdlib.h声明qsort函数,并避免警告不一致的dll链接。
typedef int (*FT)(const void*, const void*); //FT has C++ linkage
extern "C"{
typedef int (__cdecl *CFT)(const void*, const void*);//CFT has C linkage
void __cdecl qsort(void*p, size_t n, size_t sz, CFT cmp);//cmp has C linkage
}
c:\ bjarne_exercise_5.cpp(15):警告C4273:'qsort':不一致的dll链接 c:\ program files \ microsoft visual studio 10.0 \ vc \ include \ stdlib.h(425):参见先前'qsort'的定义