| 
안녕하세요 스페로 입니다.
 extern int number; --> 변수 정의
 
 number라는 변수는 어디에도 선언 되어 있지 않습니다.
 
 다르는 cpp파일에 int number라고 선언 되어 있어야 합니다.
 
 링크시에 number라는 변수가 선언된 오브젝트를 몿찾는 다는 에러 입니다.
 
 
 
 
 조승희 님이 쓰신 글 :
 : 초보적인 질문인데요
 :
 : ================================================
 : Header.h
 : extern int number;
 : =================================================
 : Main.cpp
 : #include <stdio.h>
 : #include "Header.h"
 :
 :
 : void main()
 : {
 :     number=100;
 :     printf("%d",number);
 : }
 : ==================================================
 : Compiling...
 : Main2.cpp
 : Linking...
 : Main.obj : error LNK2001: unresolved external symbol "int  number" (?number@@3HA)
 : Debug/App.exe : fatal error LNK1120: 1 unresolved externals
 : Error executing link.exe.
 :
 : 위와 같은 에러가 나네요
 : 정말 간단하지 않아요 제가 뭘잘못한건지 모르겠네요..
 : 툴은 비쥬얼 스튜디오를 쓰고요
 |