链接时出现:undefined reference to 错误的问题怎么解决?
我在终端下对程序进行链接后出现了以后提示:
/usr/acis/bin/linux_so_debug/libSpaHBridge.so:undefined reference to 'Hc_Show_Shell_Size'
程序在编译时能通过,但是在链接时就出现以上的问题,请大家帮一下忙啊!!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
把用C代码实现的部分用extern "C"
{
.....
}
试一下
链接后,错误信息是这样的:
[root@LF NCsimu]# make -f lqxyzMakefile
g++ -lpthread -o /home/fc/hou/NCsimu/SpheredisXYZ3
/home/fc/hou/NCsimu/ncstixel1/Array.o
/home/fc/hou/NCsimu/ncstixel1/VbIo.o
/home/fc/hou/NCsimu/ncstixel1/VbOutput.o
/home/fc/hou/NCsimu/ncstixel1/VbInput.o
/home/fc/hou/NCsimu/ncstixel1/VbNormal.o
/home/fc/hou/NCsimu/ncstixel1/VbPoint1.o
/home/fc/hou/NCsimu/ncstixel1/VbStixel7.o
/home/fc/hou/NCsimu/ncstixel1/VbPlane6.o
/home/fc/hou/NCsimu/ncstixel1/VbSpCube.o
/home/fc/hou/NCsimu/ncstixel1/VbSpace16.o
/home/fc/hou/NCsimu/ncstixel1/VbMisc.o
/home/fc/hou/NCsimu/ncstixel1/VbVoxelLayer.o
/home/fc/hou/NCsimu/ncstixel1/voxel.o
/home/fc/hou/NCsimu/ncstixel1/ncstixel1.o
/home/fc/hou/NCsimu/ncview/MyUIRegion.o
/home/fc/hou/NCsimu/ncview/MyColWheel.o
/home/fc/hou/NCsimu/ncview/MyColEd.o
/home/fc/hou/NCsimu/ncview/MyColSlider.o
/home/fc/hou/NCsimu/ncview/MyColPatch.o
/home/fc/hou/NCsimu/ncview/MyFloatCBList.o
/home/fc/hou/NCsimu/ncview/MySlider.o
/home/fc/hou/NCsimu/ncmarch/MarchingCubes1.o
/home/fc/hou/NCsimu/ncmarch/MarchPrivate1.o
/home/fc/hou/NCsimu/ncmarch/printSubdivGraph.o
/home/fc/hou/NCsimu/ncmarch/SegmentData.o
/home/fc/hou/NCsimu/ncmarch/TriangulateCache.o
/home/fc/hou/NCsimu/ncmarch/PatchCracks.o
/home/fc/hou/NCsimu/ncmarch/SoVertexLabel.o
/home/fc/hou/NCsimu/ncmarch/SubDivEntry.o
/home/fc/hou/NCsimu/ncmarch/isMaterial.o
/home/fc/hou/NCsimu/ncmarch/GetHalfMaterial1.o
/home/fc/hou/NCsimu/ncmarch/util.o
/home/fc/hou/NCsimu/ncmarch/Nc_MarchCubeDisplay.o
/home/fc/hou/NCsimu/werkzeug/NcCylinder.o
/home/fc/hou/NCsimu/werkzeug/NcKugel.o
/home/fc/hou/NCsimu/werkzeug/NcTorus2.o
/home/fc/hou/NCsimu/werkzeug/NcKegel.o
/home/fc/hou/NCsimu/werkzeug/NcFass.o
/home/fc/hou/NCsimu/werkzeug/NcMaterial1.o
/home/fc/hou/NCsimu/werkzeug/NcSchaufelRad.o
/home/fc/hou/NCsimu/ncvoxel/VxCylinder4.o
/home/fc/hou/NCsimu/ncvoxel/VxKugel4.o
/home/fc/hou/NCsimu/ncvoxel/VxTorus1.o
/home/fc/hou/NCsimu/ncvoxel/VxKegel.o
/home/fc/hou/NCsimu/ncvoxel/VxFass.o
/home/fc/hou/NCsimu/ncvoxel/VxMaterial1.o
/home/fc/hou/NCsimu/ncsimulation/NcSimuSpurModell1.o
/home/fc/hou/NCsimu/SpheredisXYZ3.o
/home/fc/hou/NCsimu/input/ReadCLDATA.o
/home/fc/hou/NCsimu/MaterialModell/NcPathDis.o
-L/usr/X11R6/lib
/usr/lib/InventorDebug/libInventor.so
/usr/lib/InventorDebug/libInventorXt.so
/usr/acis/bin/linux_so_debug/libSpaHPart.so
/usr/acis/bin/linux_so_debug/libSpaHBridge.so
/usr/acis/bin/linux_so_debug/libSpaABlend.so
/usr/acis/bin/linux_so_debug/libSpaACIS.so
/usr/acis/bin/linux_so_debug/libSpaALops.so
/usr/acis/bin/linux_so_debug/libSpaAPart.so
/usr/acis/bin/linux_so_debug/libSpaASurf.so
/usr/acis/bin/linux_so_debug/libSpaAVis.so
/usr/acis/bin/linux_so_debug/libSpaAWarp.so
/usr/acis/bin/linux_so_debug/libSpaBase.so
# -lGLU -lGL -lX11 -lm -lXt -lXm -lXext
-lGLU -lGL -lX11 -lm -lXt
/usr/bin/ld: warning: libSpaBase.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSpaACIS.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSpaAPart.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSpaHBridge.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSpaAVis.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libhoops920.so, needed by /usr/acis/bin/linux_so_debug/libSpaHPart.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libSpaABlend.so, needed by /usr/acis/bin/linux_so_debug/libSpaALops.so, not found (try using -rpath or
-rpath-link)
/usr/bin/ld: warning: libSpaALops.so, needed by /usr/acis/bin/linux_so_debug/libSpaASurf.so, not found (try using -rpath or -rpath-link)
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Shell_Size'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Reset_System'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Open_Geometry'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Move_By_Key'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Marker_Size'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Compute_Coordinates'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Find_Contents'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Normal'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Parse_String'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Open_Vertex'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KShow_Owner_By_Key'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Line_Weight'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Key_Type'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Delete_By_Key'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Text'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KOpen_Segment'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Net_Normal'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Key_Status'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Color_By_Value'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Open_Segment_By_Key'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_NURBS_Curve'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_User_Index'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Elliptical_Arc'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Text_Font'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Begin_Contents_Search'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Modelling_Matrix'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Close_Vertex'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_End_Contents_Search'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Heuristics'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Shell'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Close_Segment'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Color'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Owner_By_Key'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Close_Geometry'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Define_Texture'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Insert_PolyCylinder'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Insert_Line'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_One_Net_User_Index'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Open_Segment'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Parameter'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Set_Visibility'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Local_Light'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Show_Shell'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Spot_Light'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Distant_Light'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Report_Error'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Line'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Marker'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_KInsert_Polyline'
/usr/acis/bin/linux_so_debug/libSpaHBridge.so: undefined reference to `HC_Compute_Optimized_Shell'
collect2: ld returned 1 exit status
make: *** [default] Error 1
缺少 lib, Hc_Show_Shell_Size 在哪个 so 中? 连接之