我在xcode项目中使用了一个cpp文件。在cpp文件我做了以下在cpp中声明的gloabal变量在目标c中使用
ReadYML.h
typedef struct {
float Position[3];
float Color[4];
float TexCoord[2];
} Vertex_OR;
extern Vertex_OR Vertices_OR [100];
extern GLubyte Indices_OR [30];
在ReadYML.cpp
我赋值这一点。
在view.m
我宣布 “sample.h”
,并试图访问Vertices_OR和Indices_OR但我得到下面的错误?
Undefined symbols for architecture i386:
"_Indices_OR", referenced from:
loadyml() in ReadYMLfile.o
"_Vertices_OR", referenced from:
loadyml() in ReadYMLfile.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这里有什么问题?我需要使用在“Sample.h”中声明的全局变量来访问view.m?可能吗?
'出现view.m'未包含在此链接器错误中;而是它看起来像'ReadYMLFile.o'。 – trojanfoe 2013-03-07 16:22:09