这个鬼问题折磨死我了,请大虾帮助!identifier "omp_get_num_threads" is undefined
江南一风 2010-05-11 12:32:15 简单程序:
#include <omp.h>
int main(int argc, char *argv[]) {
#pragma omp parallel num_threads(8)
printf("Hello, World!, ThreadId=%d\n", omp_get_num_threads());
return 0;
}
问题:
>------ 已启动生成: 项目: hello1, 配置: Debug Win32 ------
1>Compiling with Intel(R) C++ Compiler 11.1.071 [IA-32]... (Intel C++ Environment)
1>hello1.cpp
1>Warning #673: the initial sequence of preprocessing directives is not compatible with those of precompiled header file "Debug\hello1.pchi"
1>
1>.\hello1.cpp(4): error: identifier "omp_get_num_threads" is undefined
1> printf("Hello, World!, ThreadId=%d\n", omp_get_num_threads());
1> ^
1>
1>compilation aborted for .\hello1.cpp (code 2)
1>Build log was saved at "file://D:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\hello1\hello1\Debug\BuildLog.htm"
1>hello1 - 1 error(s), 0 warning(s)
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
对omp的库函数调用似乎没起到作用。请高手帮我解决这个入门级问题,不胜感激!!!
首先,我开启/Qopenmp选项了,也用intel编译器了。
真不知道什么问题,跪求解决方案!