在ubuntu上链接代码期间,我收到以下错误
undefined reference to 'std::__default_alloc_template<true, 0>::deallocate(void*, unsigned int)'
我尝试了几个g ++编译器,但没有任何改变。我在之前的答案中找到的原因是错误的配置,如果包括。以下是代码中的内容:
#pragma warning(disable:4786)
#include <stdio.h>
#include <map>
#include <string>
#include <vector>
#include <png.h>
#include <math.h>
#include <ft2build.h>
#include <gd.h>
#include FT_FREETYPE_H
using namespace std;
#ifndef WIN32
#define stricmp strcasecmp
#else
#include <io.h>
#include <fcntl.h>
#endif
请帮忙解决这些问题?
答案 0 :(得分:0)
您可能正在编译并将与gcc
而不是g++
联系起来。对于编译,没有太大的区别。 GCC使用文件扩展名来猜测真实语言,但在链接时,g++
也会引入C ++标准库,这是通常定义分配器的地方。