2013-03-08 1 views
0

스택 오버플로해결되지 않은 외부 기호 LNK2019 혼동

나는 LNK2019 오류를 성공적으로 해결하려고 노력하고 있습니다. 나는 몇 가지 유사한 게시물을 여기에서 보았으므로이 문제에 정당한 절차를 부여하고 다른 게시물을 읽었으며 직접 해결하려고했습니다. 내 이해에 근본적으로 잘못된 것이있을 수 있으므로 귀하의 의지에 감사드립니다. 나는 최근 Python에서 C++로 전환 했으므로 n00bishness를 변명하십시오.

제가 배운 것은이 오류가 종종 다른 라이브러리에서 컴파일 됨으로 인해 발생한다는 것입니다. 그러나 이것이 어떻게 저에게 맞을 지 모르겠습니다. 중요하다면 스탠포드 C++ 라이브러리를 사용하고 있습니다. VC++ 사용 2008.

#include <iostream> 
#include "lexicon.h" 
#include "queue.h" 
#include "simpio.h" 
#include "vector.h" 
#include "console.h" 

using namespace std; 
void findchoices(string &startword, string &endword); 


int main(Lexicon &choices) { 
    string startword = getLine("Enter start word (RETURN to quit): "); 
    string endword = getLine("Enter end word (RETURN to quit): "); 

    if (startword == "") return 0; 
    if (endword == "") return 0; 

    //cout<< startword << " " << endword << endl; 

    findchoices(startword, endword); 

    //foreach (string j in choices) { 
    // cout << j << endl; 
    //} 

    return 0; 
} 

void findchoices(string &startword, string &endword) { 
    Lexicon english("EnglishWords.dat"); 
    Lexicon choices; 

    foreach (string i in english) {if (i.length() == startword.size()) choices.add(i);} 
    foreach (string i in choices) {cout<<i<<endl;} 

} 

그래, 맞아.

오류 :

당신이 int main(Lexicon &choices)main를 정의하는 이유
1>StanfordCPPLib.lib(main.obj) : error LNK2019: unresolved external symbol "int __cdecl Main(void)" ([email protected]@YAHXZ) referenced in function "int __cdecl Main(int,char * *)" ([email protected]@[email protected]) 
1>G:\assign2-wordladder-randomwriter-PC\WordLadder\Debug\WordLadder.exe : fatal error LNK1120: 1 unresolved externals 
+0

이 C++ .NET은 무엇입니까? –

+0

아니, 나는 그렇게 생각하지 않는다. vC++ 2008 Express Edition. –

+0

'foreach (string i in english)'는 네이티브 언어가 아닙니다. C++ –

답변

2

? 변경 대상 :

int main() { 
    //... 
} 
+0

내 친구 고마워. –

+0

@TylerSeymour 문제가 해결 되었습니까? 솔직히, 당신의 오류 메시지가 이상하게 보입니다. 그리고 나는 그 대답을 확신하지 못합니다. –

+0

예, 매우 우아하게 해결되었습니다. 내 오류가 사라지고 연결되었습니다! 다시 한번 감사드립니다. –

관련 문제