سؤال

أحصل على هذه الأخطاء غير القاتلة فقط في بناء تطبيقي. ويستخدم إطار عمل خاص يسمى LGI. بناء على 10.5.8 باستخدام Xcode 3.1.4 (الأحدث ل Leopard؟) يبدو الخطأ هكذا:

Ld /Users/matthew/Code/Scribe-Branches/v2.00/build/Development/Scribe.app/Contents/MacOS/Scribe normal i386
    cd /Users/matthew/Code/Scribe-Branches/v2.00
    /Developer/usr/bin/g++-4.0 -arch i386 -L/Users/matthew/Code/Scribe-Branches/v2.00/build/Development -F/Users/matthew/Code/Scribe-Branches/v2.00/build/Development -F/Users/matthew/Code/Lgi/build -F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development -F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development -F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment -F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development -F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment -filelist /Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Development/Scribe.build/Objects-normal/i386/Scribe.LinkFileList -framework Carbon -framework Lgi -o /Users/matthew/Code/Scribe-Branches/v2.00/build/Development/Scribe.app/Contents/MacOS/Scribe
Undefined symbols:
  "non-virtual thunk to GWindow::OnDrop(char*, GVariant*, GdcPt2, int)", referenced from:
      vtable for ScribeWndin ScribeApp.o
      vtable for GShutdownin ScribeApp.o
      vtable for CalendarUiin Calendar.o
      vtable for CalendarViewWndin CalendarView.o
      vtable for CalendarConfigin CalendarView.o
      vtable for ScribeExportin Exp_Scribe.o
      vtable for GNewMailDlgin GNewMailDlg.o
      ....etc for lots of classes....

على أي حال ، أعلم أنني لا أترك هؤلاء غير المحددين لأنه في الواقع يرتبط ويستمر بشكل جيد في بناء التطوير. الآن بعد googling المشكلة ، أول شيء تجربته هو تغيير إعداد التحسين ، وهو ما فعلته ... وليس النرد. بعض خطأ الارتباط.

لذلك يتم تعريف هذه الوظائف الافتراضية في البداية في GdragdropTarget ، ويرجع Gwindow على هذا النحو:

class LgiClass GWindow : public GView
#ifndef WIN32
    , public GDragDropTarget
#endif

(Lgiclass يجري ل __declspec التصدير/الاستيراد على win32)

أي أفكار حول ما يجب محاولة في المرة القادمة؟

راجع للشغل هذه بعض أعلام المثال للإطار:

CompileC build/Lgi.build/Deployment/Lgi.build/Objects-normal/i386/GViewCommon.o 
/Users/matthew/Code/Lgi/src/common/Lgi/GViewCommon.cpp normal i386 c++ 
com.apple.compilers.gcc.4_0
cd /Users/matthew/Code/Lgi
/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs 
-fpascal-strings -fasm-blocks -Os -Wreturn-type -Wunused-variable 
-isysroot /Developer/SDKs/MacOSX10.4u.sdk -fvisibility-inlines-hidden 
-mmacosx-version-min=10.4 
-I/Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/Lgi.hmap 
-F/Users/matthew/Code/Lgi/build/Deployment 
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks -Iinclude/common 
-Iinclude/mac -Iinclude/posix -I/Users/matthew/Code/Lgi/build/Deployment/include 
-I/Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/DerivedSources/i386 
-I/Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/DerivedSources 
-DMAC 
-include /var/folders/b4/b4LnxwCQGLCmwy36TH3QuU+++TQ/-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/Lgi_Prefix-aukthgaeovjxcucuoascfyqekpzz/Lgi_Prefix.pch -c /Users/matthew/Code/Lgi/src/common/Lgi/GViewCommon.cpp 
-o /Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/Objects-normal/i386/GViewCommon.o

Ld /Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/Objects-normal/i386/Lgi normal i386
cd /Users/matthew/Code/Lgi
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/Developer/usr/bin/g++-4.0 -arch i386 -dynamiclib -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
-L/Users/matthew/Code/Lgi/build/Deployment 
-F/Users/matthew/Code/Lgi/build/Deployment 
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks 
-filelist /Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/Objects-normal/i386/Lgi.LinkFileList 
-install_name @executable_path/../Frameworks/Lgi.framework/Versions/A/Lgi 
-mmacosx-version-min=10.4 -framework Carbon 
-framework SystemConfiguration -Wl,-single_module -compatibility_version 1 
-current_version 1 -o /Users/matthew/Code/Lgi/build/Lgi.build/Deployment/Lgi.build/Objects-normal/i386/Lgi

وهذه هي أعلام الترجمة/الارتباط للتطبيق:

    CompileC build/Scribe.build/Deployment/Scribe.build/Objects-normal/ppc/IHttp.o 
/Users/matthew/Code/Lgi/src/common/INet/IHttp.cpp normal ppc c++ com.apple.compilers.gcc.4_0
cd /Users/matthew/Code/Scribe-Branches/v2.00
/Developer/usr/bin/gcc-4.0 -x c++ -arch ppc -fmessage-length=0 -pipe -Wno-trigraphs 
-fpascal-strings -Os -mdynamic-no-pic -DMAC -DSCRIBE_APP -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
-mtune=G4 -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.4 
-I/Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/Scribe.hmap 
-F/Users/matthew/Code/Scribe-Branches/v2.00/build/Deployment -F/Users/matthew/Code/Lgi/build 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-I/Users/matthew/libpng-1.2.37 -I/Users/matthew/jpeg-6b -I../../Lgi/include/common 
-I../../Lgi/include/mac -I../../aspell-0.60.6/interfaces/cc 
-I/Users/matthew/Code/Scribe-Branches/v2.00/build/Deployment/include 
-IResources -I../Lgi/include/common -I../Lgi/include/mac 
-I/Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/DerivedSources/ppc 
-I/Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/DerivedSources 
-DMAC 
-include /var/folders/b4/b4LnxwCQGLCmwy36TH3QuU+++TQ/-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/Scribe_Prefix-ebutivbeomfbzzguhklrzxnwuwzc/Scribe_Prefix.pch 
-c /Users/matthew/Code/Lgi/src/common/INet/IHttp.cpp 
-o /Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/Objects-normal/ppc/IHttp.o

Ld /Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/Objects-normal/i386/Scribe 
normal i386
cd /Users/matthew/Code/Scribe-Branches/v2.00
setenv MACOSX_DEPLOYMENT_TARGET 10.4
/Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk 
-L/Users/matthew/Code/Scribe-Branches/v2.00/build/Deployment 
-F/Users/matthew/Code/Scribe-Branches/v2.00/build/Deployment 
-F/Users/matthew/Code/Lgi/build 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Development 
-F/Users/matthew/Code/Scribe-Branches/v2.00/../../Lgi/build/Deployment 
-filelist /Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/Objects-normal/i386/Scribe.LinkFileList 
-mmacosx-version-min=10.4 -framework Carbon -framework Lgi 
-o /Users/matthew/Code/Scribe-Branches/v2.00/build/Scribe.build/Deployment/Scribe.build/Objects-normal/i386/Scribe

Undefined symbols:
"non-virtual thunk to GWindow::OnDrop(char*, GVariant*, GdcPt2, int)", referenced from:
    vtable for ScribeWndin ScribeApp.o
    vtable for GShutdownin ScribeApp.o

لست متأكدًا من ما هو مناسب ، لذا قمت بنشرهم جميعًا.

هل كانت مفيدة؟

المحلول 3

لقد صنعت إطارًا صغيرًا وتطبيقًا يتبع كل الأنماط/الوريثين في الفصل الدراسي الذي أستخدمه في تطبيقي الرئيسي ، مع عرض نحو تقديم مثال بسيط للمشكلة. لكن هذا تم تجميعه وربطه. لم أستطع التأكد مما إذا كان ذلك لأنني قمت بقطع الكثير من التعليمات البرمجية منه ، أو بسبب إعادة إنشاء ملفات المشروع في الإصدار الحالي من XCode قد حدد المشكلة.

لذا ، حاول عزل أي من هذه الحالات كان صحيحًا ، لقد قمت بإعادة إنشاء مشروع الإطار الخاص بي بالكامل من نقطة الصفر (بسرعة إلى الأمام بعض ساعات) والتي تبني في وضع "الإصدار" (وليس النشر) والروابط مع تطبيقي دون أي أخطاء! هاه؟ ooooooooooooook.

هذا يعني أن ملف المشروع الأصلي مكسور بطريقة ما لا يمكن رؤيته بسهولة في الخيارات. لقد اختفت جميع الخيارات مقابل مشروع تم إنشاؤه حديثًا وهو جميل 1: 1. لا شيء مختلف بشكل واضح. لذلك شيء غير مرئي في ملف الخيارات. إحدى المشكلات التي واجهتها هي عدم ملاحظة أن خيارات المشروع تختلف فعليًا عن الخيارات المستهدفة. الآن بعد أن عرفت أن ننظر في كلا المكانين ، يمكنني أن أرى أين تعترض بعض الخيارات "المحددة للمستخدمين" في الطريق.

لقد مر ملف المشروع القديم بالعديد من ترقيات نظام التشغيل والعديد من ترقيات Xcode ... أعتقد أنه من الممكن أن تكون بعض الترقيات قد تعارضت مع المشروع. لذا شكرًا على القراءة وعلى تعليقاتك.

تحديث: حسنًا ، بعد الحصول على وضع "الإصدار" للتجميع ، خمن ماذا؟ يوب تصحيح لا يجمع. arrrrgggggggghhhh !! لذلك قمت بنسخ جميع الإعدادات للإطار بحيث يكون بناء التصحيح هو نفسه تمامًا بناء الإصدار لكل من الهدف والمشروع. هذا لا يربط. يستمر العمل ...

تبين أن الفرق الأخير بين الإصدار وبناء التصحيح للتطبيق ، هو أنني أقوم بتحديد "_debug" لبناء التصحيح. الذي يغير أشياء مختلفة مثل التأكيدات وبعض واجهة برمجة تطبيقات الأخطاء الإضافية. الآن عليّ أن أحدد أي من هؤلاء يسبب خطأ الارتباط.

نصائح أخرى

وجدت هذا المنشور من مات ، من المفترض أن يكون هناك شخص في Apple: http://lists.apple.com/archives/unix-porting/2003/dec/msg00107.html

في ذلك ، يقول مات:

thunk غير الذروة] هو تفاصيل التنفيذ الداخلية المستخدمة في التسلسلات الهرمية للفئة C ++ التي تنطوي على ميراث متعدد. أنت لا تفعل أي شيء خاطئ. هذا هو علة المترجم. نحن نعلم أننا بحاجة إلى إصلاحه. في الوقت نفسه ، فإن أفضل حلول نعرفه هو استخدام نفس مستوى التحسين للربط مع مكتبة استخدمتها لتجميع المكتبة.

(قد تفكر أيضًا في عدم تصدير واجهة C ++ من مكتبة. نحن نعمل بجد للتأكد من أن C و C abi يبقى كما هو من إصدار مترجم واحد إلى آخر ، لكننا لا نقدم هذا الوعد لـ C ++.)

      --Matt

لذلك ربما تحاول استخدام مكتبة C ++ التي تم تجميعها بواسطة برنامج التحويل البرمجي C ++ مختلف بشكل مختلف؟ لا يتم تعريف C ++ ABI على أنه محمول على ما يبدو.

ريد

لماذا لا تغير أعلام البرمجيات الخاصة ببناء الإنتاج الخاص بك إلى تلك التي تستخدمها للتطوير ، ثم تغييرها تدريجياً لتبدو وكأنها أعلام الإنتاج التي تستخدمها الآن واحدة في ذلك الوقت حتى تصطاد تلك التي تسبب المشكلة؟

ثم يمكنك أن تنظر إلى هذا العلم في دليل GCC وحفر أعمق.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top