0
我正在用g ++ 4.7编译redhat Linux中的算法代码,但遇到一些问题。头文件是一个C++文件的用途是波纹管:错误:'_mm_prefetch'未在此范围内声明
但在编译的时候,它会出现一些错误,比如
error: '_mm_prefetch' was not declared in this scope
error: '_MM_HINT_T0' was not declared in this scope
我怎么能解决这个问题?非常感谢你!!
#include <cmath>
#include <memory>
#include <iostream>
#include <mmintrin.h>
#include "space.h"
#include "knnquery.h"
#include "rangequery.h"
#include "ported_boost_progress.h"
#include "method/small_world_rand.h"
#include "sort_arr_bi.h"
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <typeinfo>
//#define START_WITH_E0
#define START_WITH_E0_AT_QUERY_TIME
#define USE_BITSET_FOR_INDEXING 1
//#define USE_ALTERNATIVE_FOR_INDEXING
namespace similarity {
using namespace std;
template <typename dist_t>
struct IndexThreadParamsSW {
const Space<dist_t>& space_;
SmallWorldRand<dist_t>& index_;
const ObjectVector& data_;
在这个C++文件中,有使用该代码的地方:
for (MSWNode* neighbor : (currEv.getMSWNode())->getAllFriends()) {
_mm_prefetch(reinterpret_cast<const char*>(const_cast<const Object*>(neighbor->getData())), _MM_HINT_T0);
}
for (MSWNode* neighbor : (currEv.getMSWNode())->getAllFriends()) {
_mm_prefetch(const_cast<const char*>(neighbor->getData()->data()), _MM_HINT_T0);
}
当编译器抱怨有关符号未被声明时,那么解决方案似乎相当明显:声明它们。 –