1
我在xcode和C++中使用GLUT & OpenGL製作遊戲。我希望把我在遊戲中的3D模型,這是頭文件的一般外觀:xcode ld:體系結構x86_64的8個重複符號
unsigned int GunNumVerts = 37812;
float GunVerts [] = {
// f 1/1/1 1582/2/1 4733/3/1
0.266494348503772, 0.0252334302709736, -0.000725898139236535,
0.265592372987502, 0.0157389511523397, -0.000725898139236535,
0.264890836474847, 0.0182004476109518, -0.00775888079925833,}
float GunNormals [] = {
// f 1/1/1 1582/2/1 4733/3/1
0.986904930120225, -0.0937549933614904, -0.131257990706016,
0.986904930120225, -0.0937549933614904, -0.131257990706016,
0.986904930120225, -0.0937549933614904, -0.131257990706016,}
float GunTexCoords [] = {
// f 1/1/1 1582/2/1 4733/3/1
0.110088, 0.229552,
0.108891, 0.243519,
0.119508, 0.240861,}
我收到此錯誤吧:
duplicate symbol _GunNumVerts in: /blah/blah/blah/Mouse.o
/blah/blah/blah/ViewPort.o
ld: 8 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我試圖顯示此我在我的視口顯示方法如下:
glVertexPointer(3, GL_FLOAT, 0, GunVerts);
glNormalPointer(GL_FLOAT, 0, GunNormals);
glTexCoordPointer(2, GL_FLOAT, 0, GunTexCoords);
glDrawArrays(GL_TRIANGLES, 0, GunNumVerts);
我有7個其他重複的符號小短語,但只有一個實際的錯誤。
非常感謝您的幫助,因爲它解決了我的問題,但現在我得到了每個浮點數中「數組初始化符中的過量元素」的問題。我將如何解決這個問題? –
大多數伊利你弄亂了元素的數量。 'float a [42] = {1,2};'不起作用。 – Marius
哦jeez,theres成千上萬,我在終端使用.pl給我的頂點數等。感謝您幫助我解決這個問題。 –