我正在編譯一個Fedora 8盒子上的Blender 3D建模程序from source(使用SCONS)的一個分支,並且遇到了一個錯誤,我沒有遇到在CentOS 5盒子上編譯同一個源文件,我我認爲它與變量定義有關。錯誤是:「#pragma」命令中的變量「undeclared」?
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有點過時,它可能會有一些舊版本的編譯器將其搞亂。任何人都有一個想法,我如何解決這個變量顯示爲「未聲明」?
使用新編譯器 – Anycorn 2010-07-20 19:32:04
使用gcc版本4.1.2 20070925(Red Hat 4.1.2-33);我需要走多少新的? – MidnightLightning 2010-07-20 19:43:27
很可能在您的編譯器中,OpenMP實現不瞭解是否有條件。 嘗試g ++ 4.4或更高版本。或者,如果條件 – Anycorn 2010-07-20 20:16:30