Еще один LNK2019: неразрешенный внешний символ

Я создаю основу для школьного проекта, но сталкиваюсь с ошибками «неразрешенный внешний символ». Согласно предыдущим проблемам, упомянутым на этом сайте, я думаю, что мне нужно вручную связать мой проект с файлом .lib. Проблема в том, что я точно не знаю, на какой .lib мне нужно сослаться. Кто-нибудь может объяснить, будто мне двенадцать?

1>------ Build started: Project: Birthday311, Configuration: Debug Win32 ------
1>Build started 2/2/2012 07:55:30 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\Birthday311.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getDay(void)const " (?getDay@Birthday@@QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor@@YAXAAVTester@@@Z)
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Birthday::getMonth(void)const " (?getMonth@Birthday@@QBEHXZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor@@YAXAAVTester@@@Z)
1>birthday_test.obj : error LNK2019: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall Birthday::getName(void)const " (?getName@Birthday@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "void __cdecl test_class_Birthday_default_ctor(class Tester &)" (?test_class_Birthday_default_ctor@@YAXAAVTester@@@Z)
1>C:\Users\Ender\Documents\Visual Studio 2010\Projects\Birthday311\Debug\Birthday311.exe : fatal error LNK1120: 3 unresolved externals

person derp    schedule 03.02.2012    source источник
comment
Как нам узнать, какой .lib файл? Какой из них содержит определения функций Birthday::getDay и Birthday::getMonth? Они не являются частью какой-либо стандартной библиотеки, о которой я знаю, поэтому вы должны были написать их сами.   -  person Cody Gray    schedule 03.02.2012
comment
О, ты помог мне найти правильный ответ. Взглянув на свой файл .cpp, я понял, что просто назвал функции getDay и getMonth как int getDay() вместо int Birthday::getDay() const. Спасибо!   -  person derp    schedule 03.02.2012


Ответы (1)


Похоже, вы на самом деле не реализовали функции getDay, getMonth и getName.

person user973572    schedule 03.02.2012
comment
О, ты помог мне найти правильный ответ. Взглянув на мой файл .cpp, я понял, что просто вызывал функции getDay и getMonth как «int getDay()» вместо «int Birthday::getDay() const». По сути, я неправильно реализовал функции getDay и getMonth. Спасибо! - person derp; 03.02.2012