البرمجة

حل مشكلة unresolved external symbol في C++

The error you’re encountering, “unresolved external symbol __imp__StrStrIA@8 referenced in function,” indicates that the linker can’t find the definition for the function StrStrIA which you are using in your code. This function is a part of the Windows API and is used for string searching.

The reason for this error is that you’re missing the necessary library to link against. To resolve this, you need to add the Shlwapi.lib library to your linker settings.

Here’s how you can do it in Visual Studio:

  1. Right-click on your project in the Solution Explorer.
  2. Select “Properties.”
  3. In the Property Pages dialog, navigate to Configuration Properties -> Linker -> Input.
  4. Add “Shlwapi.lib” to the Additional Dependencies field.

After adding the library, try building your project again. This should resolve the linker error, and your program should compile and link successfully.

If you’re using a different IDE or build system, you’ll need to find the equivalent way to add the Shlwapi.lib library to your linker settings.

المزيد من المعلومات

طبقاً للرسالة التي تلقيتها “unresolved external symbol __imp__StrStrIA@8 referenced in function,” تشير هذه الرسالة إلى أن المترجم (اللينكر) غير قادر على العثور على تعريف لدالة StrStrIA التي تستخدمها في كودك. هذه الدالة تنتمي إلى واجهة برمجة التطبيقات في نظام ويندوز وتُستخدم للبحث في السلاسل النصية.

السبب وراء هذا الخطأ هو نقص مكتبة الربط اللازمة. لحل هذه المشكلة، يجب عليك إضافة مكتبة Shlwapi.lib إلى إعدادات الربط الخاصة بك.

إليك كيفية القيام بذلك في بيئة التطوير Visual Studio:

  1. انقر بزر الماوس الأيمن على مشروعك في استكشاف الحلول.
  2. حدد “الخصائص”.
  3. في نافذة الخصائص، انتقل إلى “خصائص التكوين” -> “الربط” -> “الإدخال”.
  4. أضف “Shlwapi.lib” إلى حقل الاعتماديات الإضافية.

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

إذا كنت تستخدم بيئة تطوير مختلفة أو نظام بناء، فيجب عليك العثور على الطريقة المعادلة لإضافة مكتبة Shlwapi.lib إلى إعدادات الربط الخاصة بك.

زر الذهاب إلى الأعلى