2013-04-23 39 views
0

我有以下生成文件:OSX:文件是專爲存檔這不是架構被鏈接(I386)

PROG = tracecone 
RBASE= /Users/owner/Documents/raytrace 
GDIR=$(RBASE)/Graphics 
MDIR=$(RBASE)/VrMath 
ODIR=$(RBASE)/OpenglRender 
MANDIR=$(RBASE)/RaytraceMgr 

CFLAGS = -w -s -O2 -ansi -DSHM -m32 
XLIBS = -lX11 -lXext -lXmu -lXext -lXmu -lXt -lXi -lSM -lICE 
LIBS = -lglut -lGLU -lGL 
RAYLIBS = -lraygraph -lvrmath 
INCLS = -I/usr/X11R6/include -I/usr/X11/include/GL 
INCL1 = -I$(GDIR) -I../RayTrace -I$(GDIR) -I$(MDIR) -I$(ODIR) -I$(MANDIR) 
LIBDIR = -L/usr/X11/lib -L/usr/X11R6/lib -L$(GDIR) -L$(MDIR) 
#source codes 
SRCS = $(PROG).cpp 

#substitute .cpp by .o to obtain object filenames 
OBJS = $(SRCS:.cpp=.o) 
#in ../Graphics 
OBJOD = $(ODIR)/GlutRenderer.o 
OBJO = GlutRenderer.o 
OBJMAND = $(MANDIR)/SceneDescription.o 
OBJMAN = SceneDescription.o 
OBJ_temp = ../RayTrace/RayTraceData.o 

#$< evaluates to the target's dependencies, 
#[email protected] evaluates to the target 

$(PROG): $(OBJS) 
    g++ -o [email protected] -m32 $(OBJ_temp) $(OBJS) $(OBJOD) $(OBJMAND) $(LIBDIR) $(LIBS) $(XLIBS) $(RAYLIBS) 

$(OBJS): 
    g++ -c -m32 $*.cpp $(INCLS) $(INCL1) 

$(OBJ1): 
    cd $(GDIR); g++ -m32 -c $*.cpp $(INCLS) 

$(OBJM): 
    cd $(MDIR); g++ -m32 -c $*.cpp $(INCLS) 

$(OBJO): 
    cd $(ODIR); g++ -m32 -c $*.cpp $(INCLS) 

$(OBJMAN): 
    cd $(MANDIR); g++ -m32 -c $*.cpp $(INCLS) 
clean: 
    rm $(OBJS) 

clean1: 
    rm $(OBJD1) 

而且我發現了以下錯誤:

g++ -c -m32 tracecone.cpp -I/usr/X11R6/include -I/usr/X11/include/GL -I/Users/owner/Documents/raytrace/Graphics -I../RayTrace -I/Users/owner/Documents/raytrace/Graphics -I/Users/owner/Documents/raytrace/VrMath -I/Users/owner/Documents/raytrace/OpenglRender -I/Users/owner/Documents/raytrace/RaytraceMgr 
     g++ -o tracecone -m32 ../RayTrace/RayTraceData.o tracecone.o /Users/owner/Documents/raytrace/OpenglRender/GlutRenderer.o /Users/owner/Documents/raytrace/RaytraceMgr/SceneDescription.o -L/usr/X11/lib -L/usr/X11R6/lib -L/Users/owner/Documents/raytrace/Graphics -L/Users/owner/Documents/raytrace/VrMath -lglut -lGLU -lGL -lX11 -lXext -lXmu -lXext -lXmu -lXt -lXi -lSM -lICE -lraygraph -lvrmath 
     ld: warning: ld: warning: ld: warning: ignoring file /Users/owner/Documents/raytrace/OpenglRender/GlutRenderer.o, file was built for unsupported file format (0x7f 0x45 0x4c 0x46 0x 2 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): /Users/owner/Documents/raytrace/OpenglRender/GlutRenderer.oignoring file /Users/owner/Documents/raytrace/RaytraceMgr/SceneDescription.o, file was built for unsupported file format (0x7f 0x45 0x4c 0x46 0x 2 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): /Users/owner/Documents/raytrace/RaytraceMgr/SceneDescription.oignoring file ../RayTrace/RayTraceData.o, file was built for unsupported file format (0x7f 0x45 0x4c 0x46 0x 2 0x 1 0x 1 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0 0x 0) which is not the architecture being linked (i386): ../RayTrace/RayTraceData.o 


ld: warning: ignoring file /Users/owner/Documents/raytrace/Graphics/libraygraph.a, file was built for archive which is not the architecture being linked (i386): /Users/owner/Documents/raytrace/Graphics/libraygraph.a 
     ld: warning: ignoring file /Users/owner/Documents/raytrace/VrMath/libvrmath.a, file was built for archive which is not the architecture being linked (i386): /Users/owner/Documents/raytrace/VrMath/libvrmath.a 
     Undefined symbols for architecture i386: 
      "_BackgroundColorR3", referenced from: 
       RayTrace(int, VectorR3 const&, VectorR3, VectorR3&, long)in tracecone.o 
      "_Cdims", referenced from: 
       ResizeWindow(int, int)in tracecone.o 
      "_GlobalAmbientR3", referenced from: 
       CalcAllDirectIllum(VectorR3 const&, VisiblePoint const&, VectorR3&, long)in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "_LightArray", referenced from: 
       CalcAllDirectIllum(VectorR3 const&, VisiblePoint const&, VectorR3&, long)in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "_MainView", referenced from: 
       ResizeWindow(int, int)in tracecone.o 
       mySpecialFunc(int, int, int)in tracecone.o 
       SetupRayTraceWorld()  in tracecone.o 
       RayTraceView()  in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "_NumLights", referenced from: 
       CalcAllDirectIllum(VectorR3 const&, VisiblePoint const&, VectorR3&, long)in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "_NumObjects", referenced from: 
       SeekIntersection(VectorR3 const&, VectorR3 const&, double*, VisiblePoint&, long)in tracecone.o 
       ShadowFeeler(VectorR3 const&, Light const&, long)in tracecone.o 
       SetupRayTraceWorld()  in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "_ViewObj", referenced from: 
       SeekIntersection(VectorR3 const&, VectorR3 const&, double*, VisiblePoint&, long)in tracecone.o 
       ShadowFeeler(VectorR3 const&, Light const&, long)in tracecone.o 
       SetupRayTraceWorld()  in tracecone.o 
       RenderWithGlut()  in tracecone.o 
      "SetUpLights()", referenced from: 
       SetupRayTraceWorld()  in tracecone.o 
      "SetUpMainView()", referenced from: 
       SetupRayTraceWorld()  in tracecone.o 
      "SetUpMaterials()", referenced from: 
       SetupRayTraceWorld()  in tracecone.o 
      "DirectIlluminateViewPos(VectorR3 const&, VectorR3 const&, VectorR3 const&, Light const&, MaterialBase const&, VectorR3&, VectorR3 const&)", referenced from: 
       DirectIlluminateViewPos(VisiblePoint const&, VectorR3 const&, Light const&, VectorR3&, VectorR3 const&)in tracecone.o 
      "GetOrtho(VectorR3 const&, VectorR3&, VectorR3&)", referenced from: 
       ViewableCone::SetCenterAxis(VectorR3 const&) in tracecone.o 
      "CameraView::RotateViewUp(double)", referenced from: 
       mySpecialFunc(int, int, int)in tracecone.o 
      "CameraView::PixelDirPreCalc()", referenced from: 
       CameraView::SetDirection(VectorR3 const&) in tracecone.o 
       CameraView::SetDirection(float const*)in tracecone.o 
       CameraView::SetDirection(double const*)in tracecone.o 
       CameraView::SetDirection(double, double, double)in tracecone.o 
      "CameraView::RecalcPixeldUdV()", referenced from: 
       CameraView::SetScreenDimensions(double, double)in tracecone.o 
       CameraView::SetScreenPixelSize(int, int)in tracecone.o 
      "CameraView::RotateViewRight(double)", referenced from: 
       mySpecialFunc(int, int, int)in tracecone.o 
      "CameraView::CalcScreenCenter()", referenced from: 
       CameraView::SetPosition(VectorR3 const&) in tracecone.o 
       CameraView::SetPosition(float const*)in tracecone.o 
       CameraView::SetPosition(double const*)in tracecone.o 
       CameraView::SetPosition(double, double, double)in tracecone.o 
       CameraView::SetDirection(VectorR3 const&) in tracecone.o 
       CameraView::SetDirection(float const*)in tracecone.o 
       CameraView::SetDirection(double const*)in tracecone.o 
       ... 
      "CameraView::RescaleDistanceOfViewer(double)", referenced from: 
       mySpecialFunc(int, int, int)in tracecone.o 
      "PixelArray::ClampAndDrawFloats()", referenced from: 
       PixelArray::Draw()  in tracecone.o 
      "PixelArray::SetSize(int, int)", referenced from: 
       ResizeWindow(int, int)in tracecone.o 
       PixelArray::PixelArray(int, int)in tracecone.o 
      "GlutRenderer::RenderViewable(ViewableBase const&)", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::FinishRendering()", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::SetupCameraView(CameraView const&, double, double)", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::SetGlobalAmbientLight(VectorR3 const&)", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::SetGlobalAmbientLight(double, double, double)", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::AddLight(Light const&)", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "GlutRenderer::GlutRenderer()", referenced from: 
       RenderWithGlut()  in tracecone.o 
      "Material::Default", referenced from: 
       ViewableCone::Reset()  in tracecone.o 
      "ViewableBase::CalcExtentsInBox(AABB const&, AABB&) const", referenced from: 
       vtable for ViewableBasein tracecone.o 
      "ViewableBase::CalcAABB(AABB&) const", referenced from: 
       vtable for ViewableBasein tracecone.o 
      "Material::CalcLocalLighting(VectorR3&, Light const&, VectorR3 const&, double, VectorR3 const&, VectorR3 const&, VectorR3 const&, VectorR3 const*) const", referenced from: 
       vtable for Materialin tracecone.o 
      "Material::Clone() const", referenced from: 
       vtable for Materialin tracecone.o 
      "vtable for ViewableCone", referenced from: 
       ViewableCone::ViewableCone()in tracecone.o 
      NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. 
     ld: symbol(s) not found for architecture i386 
     collect2: ld returned 1 exit status 
     make: *** [tracecone] Error 1 

如何我可以避免以下錯誤:

我正在使用OSX,如果這很重要。

File was built for archive which is not the architecture being linked (i386) 

在此先感謝。

+0

你是否在不同的平臺上重新制作之前運行「make clean」。 – 2013-04-23 01:31:54

+0

@賴瑞恩 - 是的,我做到了。 – UndefinedReference 2013-04-23 01:32:46

回答

1

對於GlutRenderer.o,SceneDescription.o,RayTraceData.o文件:將它們添加到您的乾淨部分和make clean。現在你只清理一個文件:tracecone.o。也許其他的目標文件是在向你的makefile中添加-m32標誌之前建立的。您也可以手動刪除所有對象文件。
在源根目錄中運行find . | grep '\.o$'以檢查清理後是否還有任何目標文件。

對於libraygraph.a和libvrmath.a:這些庫也必須使用-m32標誌構建。

相關問題