Cố gắng gỡ lỗi một số lỗi trình liên kết, tôi đã bật/VERBOSE và tôi đang cố gắng hiểu được đầu ra. Nó xảy ra với tôi rằng tôi thực sự không biết làm thế nào để đọc nó.Cách đọc đầu ra liên kết VC++ chi tiết
Ví dụ:
1>Compiling version info
1>Linking...
1>Starting pass 1
1>Processed /DEFAULTLIB:mfc80.lib
1>Processed /DEFAULTLIB:mfcs80.lib
1>Processed /DEFAULTLIB:msvcrt.lib
1>Processed /DEFAULTLIB:kernel32.lib
1>Processed /DEFAULTLIB:user32.lib
....
1>Processed /DEFAULTLIB:libgslcblasMD.lib
1>Searching libraries
1> Searching V:\Src\Solutions\\..\..\\Common\Win32\Lib\PlxApi.lib:
1> Searching ..\..\..\..\out\win32\release\lib\camerageometry.lib:
1> Searching ..\..\..\..\out\win32\release\lib\geometry.lib:
1> Found "public: __thiscall VisionMap::Geometry::Box2d::operator class VisionMap::Geometry::Box2DInt(void)const " ([email protected]@[email protected]@[email protected]@XZ)
1> Referenced in FocusDlg.obj
1> Loaded geometry.lib(Box2d.obj)
1>Processed /DEFAULTLIB:CGAL-vc80-mt.lib
1>Processed /DEFAULTLIB:boost_thread-vc80-mt-1_33_1.lib
gì đang xảy ra ở đây?
Tôi nghĩ rằng tôi hiểu chút này:
1>Processed /DEFAULTLIB:libgslcblasMD.lib
1>Searching libraries
1> Searching V:\Src\Solutions\\..\..\\Common\Win32\Lib\PlxApi.lib:
1> Searching ..\..\..\..\out\win32\release\lib\camerageometry.lib:
1> Searching ..\..\..\..\out\win32\release\lib\geometry.lib:
1> Found "public: __thiscall VisionMap::Geometry::Box2d::operator class VisionMap::Geometry::Box2DInt(void)const " ([email protected]@[email protected]@[email protected]@XZ)
1> Referenced in FocusDlg.obj
1> Loaded geometry.lib(Box2d.obj)
Nó cố gắng tìm việc thực hiện của người điều khiển ở trên, được sử dụng ở đâu đó trong FocusDlg.cpp, và nó tìm thấy nó trong geometry.lib.
Nhưng 1>Processed /DEFAULTLIB:libgslcblasMD.lib
có nghĩa là gì? Điều gì xác định thứ tự độ phân giải biểu tượng? Tại sao nó tải biểu tượng đặc biệt này trong khi xử lý libgslcblasMD.lib
thư viện của bên thứ ba là gì? Hay tôi đọc sai?
Dường như trình liên kết đang đi qua các biểu tượng được tham chiếu trong các tệp đối tượng khác nhau của dự án, nhưng tôi không có ý tưởng về thứ tự nào. Sau đó, nó tìm kiếm các thư viện tĩnh mà dự án sử dụng - bằng tham chiếu dự án, nhập khẩu rõ ràng và nhập khẩu thư viện mặc định tự động; nhưng nó làm như vậy theo thứ tự mà, một lần nữa, có vẻ tùy ý đối với tôi.
Khi nó tìm thấy một biểu tượng, ví dụ như trong geometry.lib, nó sau đó tiếp tục tìm thấy một loạt các biểu tượng khác so với cùng lib:
1> Searching V:\Src\Solutions\\..\..\\Common\Win32\Lib\PlxApi.lib:
1> Searching ..\..\..\..\out\win32\release\lib\camerageometry.lib:
1> Searching ..\..\..\..\out\win32\release\lib\geometry.lib:
1> Found "public: __thiscall VisionMap::Geometry::Box2d::operator class VisionMap::Geometry::Box2DInt(void)const " ([email protected]@[email protected]@[email protected]@XZ)
1> Referenced in FocusDlg.obj
1> Loaded geometry.lib(Box2d.obj)
1>Processed /DEFAULTLIB:CGAL-vc80-mt.lib
1>Processed /DEFAULTLIB:boost_thread-vc80-mt-1_33_1.lib
1> Found "public: __thiscall VisionMap::Geometry::Box2DInt::Box2DInt(int,int,int,int)" ([email protected]@[email protected]@[email protected]@Z)
1> Referenced in FocusDlg.obj
1> Referenced in ImageView.obj
1> Referenced in geometry.lib(Box2d.obj)
1> Loaded geometry.lib(Box2DInt.obj)
1> Found "public: virtual __thiscall VisionMap::Geometry::Point3d::~Point3d(void)" ([email protected]@[email protected]@[email protected])
1> Referenced in GPSFrm.obj
1> Referenced in MainFrm.obj
1> Loaded geometry.lib(Point3d.obj)
1> Found "void __cdecl VisionMap::Geometry::serialize<class boost::archive::binary_oarchive>(class boost::archive::binary_oarchive &,class VisionMap::Geometry::Point3d &,unsigned int)" ([email protected][email protected]@[email protected]@@[email protected]@@[email protected]@[email protected]@[email protected]@[email protected])
1> Referenced in GPSFrm.obj
1> Referenced in MainFrm.obj
1> Loaded geometry.lib(GeometrySerializationImpl.obj)
Nhưng sau đó, vì một lý do, nó đi vào để tìm các ký hiệu được định nghĩa trong các libs khác và trả về hình học sau này (một loạt các lần).
Vì vậy, rõ ràng nó không làm "nhìn vào hình học và tải mọi biểu tượng đó là tài liệu tham khảo trong dự án, và sau đó tiếp tục các thư viện khác". Nhưng nó không rõ ràng với tôi những gì là thứ tự tra cứu biểu tượng.
Và thỏa thuận với tất cả các thư viện đó được xử lý ở đầu tác phẩm của liên kết là gì, nhưng không tìm thấy bất kỳ biểu tượng nào để tải từ chúng? Dự án này có thực sự không sử dụng bất kỳ thứ gì từ msvcrt.lib
, kernel32.lib
không? Có vẻ như không.
Vì vậy, về cơ bản tôi đang tìm cách giải mã thứ tự cơ bản trong hoạt động của nhà liên kết.