이런 에러는 어느 부분을 봐야하는 걸까요..?...

sadrove의 이미지

프로그래밍 연습을 하다보면..
아래와 같은 에러를 만날때가 많은데요..
이런경우엔 보통 어떤게 잘못된 것이며..
고칠려면 어느 부분을 봐야하는 걸까요..?..^^..
초보니까 쉽게 설명해주시면 감솨....

--------------------Configuration: test - Win32 Debug--------------------
Linking...
test.obj : error LNK2001: unresolved external symbol "public: __thiscall Employee::~Employee(void)" (??1Employee@@QAE@XZ)
test.obj : error LNK2001: unresolved external symbol "public: __thiscall Date::~Date(void)" (??1Date@@QAE@XZ)
test.obj : error LNK2001: unresolved external symbol "public: void __thiscall Employee::print(void)const " (?print@Employee@@QBEXXZ)
test.obj : error LNK2001: unresolved external symbol "public: __thiscall Employee::Employee(char const *,char const *,class Date const &,class Date const &)" (??0Employee@@QAE@PBD0ABVDate@@1@Z)
test.obj : error LNK2001: unresolved external symbol "public: __thiscall Date::Date(int,int,int)" (??0Date@@QAE@HHH@Z)
Debug/test.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.

test.exe - 6 error(s), 0 warning(s)

urmajest의 이미지

보통 제대로 include가 되지 않으면 그런 에러가 뜹니다

헤더 파일과 cpp 파일에 각자에 맞게 include가 되어 있는지

확인해보시기 바랍니다 ^^

pastime의 이미지

Quote:
unresolved external symbol ...

보통 이런 에러 메시지가 나오는 경우는 라이브러리를 링크해주지 않은 경우입니다만..
여기선 그런 것 같지는 않네요.. (Employee 클래스는 직접 만드신 거겠죠?)

제가 알기로는..
코드 상에서 사용된 메소드 등이 실제로 구현되어 있지 않아서
알 수 없다고 에러 메시지를 내보내는 거라고 알고 있습니다.

이 경우 test 파일에서 사용된 Employee 나 Date 클래스의 소스를
같이 컴파일하면 될 것 같습니다..

shkwon81의 이미지

위의 에러는 모두 링크 에러입니다.

헤더 파일이 제대로 포함되어 있지 않은 경우는 (특히 C++ 이라면 더더욱)
대부분의 원하는 함수 원형을 찾아 내지 못하므로 컴파일 에러를 내게 됩니다.

링크 에러의 경우는 보통 다음과 같은 경우를 들 수 있습니다.

1. 오브젝트 파일(또는 라이브러리)을 제대로 링크하지 않았다.

2. 어떤 함수(또는 변수)를 선언만 해 놓고 제대로 정의하지 않았다.

예를 들면,

Quote:
test.obj : error LNK2001: unresolved external symbol "public: void __thiscall Employee::print(void)const " (?print@Employee@@QBEXXZ)

위에서는 test.cpp (test.cc 기타 등등) 파일에서

Employee::print(void) const 함수를 호출했고, 이 함수에 대한 원형도 존재하지만, 그 정의가 제공되지 않는다는 것을 나타냅니다. 최종 실행 파일을 생성해 내려면 어딘가에는 Employee::print(void) const 가 "정의"되어 있어야 합니다.

확인해 보시기 바랍니다.

익명 사용자의 이미지

이게 정확히 무슨 뜻인가요? 변수를 정의한다는 뜻이요.

twinwings의 이미지

// 변수 선언(주로 헤더파일, *.h)
extern int global_integer_variable;
 
// 변수 정의(주로 구현파일, *.c)
int global_integer_variable;
sadrove의 이미지

감사합니다..
해결했습니다...
답변 해준 분들께 진심으로 감사드려요..
꾸벅..

- idealist sadrove

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.