【发布时间】:2010-07-20 19:28:59
【问题描述】:
我正在 Fedora 8 机器上编译 Blender 3D 建模程序 from source(使用 SCONS)的一个分支,但遇到了一个我在编译相同源代码时没有遇到的错误一个 CentOS 5 盒子,我认为它与变量定义有关。错误是:
source/blender/blenkernel/intern/implicit.c: In function ‘mul_bfmatrix_lfvector’:
source/blender/blenkernel/intern/implicit.c:592: error: ‘CLOTH_OPENMP_LIMIT’ undeclared (first use in this function)
source/blender/blenkernel/intern/implicit.c:592: error: (Each undeclared identifier is reported only once
source/blender/blenkernel/intern/implicit.c:592: error: for each function it appears in.)
source/blender/blenkernel/intern/implicit.c: In function ‘cloth_calc_force’:
source/blender/blenkernel/intern/implicit.c:1700: error: ‘CLOTH_OPENMP_LIMIT’ undeclared (first use in this function)
文件implicit.c 确实定义了该变量;这是文件的前几行:
#include "MEM_guardedalloc.h"
#include "BKE_cloth.h"
#include "DNA_object_force.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_utildefines.h"
#include "BLI_threads.h"
#define CLOTH_OPENMP_LIMIT 25
#ifdef _WIN32
#include <windows.h>
static LARGE_INTEGER _itstart, _itend;
static LARGE_INTEGER ifreq;
引发错误的两行是:
#pragma omp parallel sections private(i) if(vcount > CLOTH_OPENMP_LIMIT)
和
#pragma omp parallel for private(i) if(numverts > CLOTH_OPENMP_LIMIT)
我猜这个错误是由于编译器以及它在编译时定义变量时的处理方式造成的,而且由于 Fedora 8 有点过时,它可能有一些旧版本的编译器把它弄乱了。任何人都知道如何绕过这个显示为“未声明”的变量?
【问题讨论】:
-
使用 gcc 版本 4.1.2 20070925 (Red Hat 4.1.2-33);我要更新多少?
-
编译器中的 OpenMP 实现很可能不理解是否有条件。尝试 g++ 4.4 或更高版本。或者,删除 if 条件
标签: c gcc openmp c-preprocessor