Microsoft MVP성태의 닷넷 이야기
오류 유형: 6. [VC++ 컴파일] already defined in ntdll.lib(ntdll.dll) [링크 복사], [링크+제목 복사],
조회: 30208
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

솔직히 이 현상을 재미있다고 표현해야 할지 모르겠지만.

최근에, 제가 "Windows 구조와 원리 그리고 Codes"라는 책을 읽고 있습니다.
거기 나온 예제를 컴파일 해보려고 했는데요.

참고로, 그 책의 소스는 아래 게시판에 "2번" 게시물로 등록되어져 있습니다.
http://cafe.naver.com/andyjung.cafe?iframe_url=/ArticleList.nhn%3Fclubid=11534822%26menuid=8%26boardtype=L%26page=

압축 파일을 풀면 "Windows_Codes" 폴더 밑으로, "ListHandles"라는 폴더가 보입니다.
제가 컴파일한 예제는 그 프로젝트입니다.

그 프로젝트를 컴파일하려면 ntdll.lib 파일이 필요한데, 이 파일은 SDK에는 포함되어 있지 않은 것으로, NT DDK를 다운로드/설치해야만 합니다. (DDK는 MSDN Subscriber에 가입된 경우에만 다운로드가 가능합니다.) 설치 후, lib 폴더를 VS.NET 2005의 "Options" 메뉴를 통해서 등록해 두어야 합니다.

어쨌든, 우여곡절 끝에 환경 구성을 한 다음.

제 컴파일 환경은 VS.NET 2005의 VC++ 8.0입니다. 그 예제는 dsw로 되어 있어서, 더블 클릭을 하게 되면 VS.NET 2005는 우선 프로젝트 변환을 하겠다고 합니다.

정상적으로 변환된 후, 컴파일을 시도하면 다음과 같은 오류가 발생합니다.

Linking...
LIBCMTD.lib(strtol.obj) : error LNK2005: _strtoul already defined in ntdll.lib(ntdll.dll)
.\Debug/ListHandles.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://d:\Snippet\BookCode\Windows_Codes\ListHandles\Debug\BuildLog.htm"
ListHandles - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

자, 이제 프로젝트 설정에서 "Use of MFC" 옵션을 기존의 "Use Standard Windows Libraries"에서 "Use MFC in a Shared DLL"로 바꿔주고 컴파일을 합니다.

프로젝트 설정

이번엔 다음과 같이 오류가 발생합니다.

------ Build started: Project: ListHandles, Configuration: Debug Win32 ------
Linking...
ListHandles.obj : error LNK2019: unresolved external symbol __imp__AdjustTokenPrivileges@24 referenced in function "int __cdecl EnablePrivilege(char const *)" (?EnablePrivilege@@YAHPBD@Z)
ListHandles.obj : error LNK2019: unresolved external symbol __imp__OpenProcessToken@12 referenced in function "int __cdecl EnablePrivilege(char const *)" (?EnablePrivilege@@YAHPBD@Z)
ListHandles.obj : error LNK2019: unresolved external symbol __imp__LookupPrivilegeValueA@12 referenced in function "int __cdecl EnablePrivilege(char const *)" (?EnablePrivilege@@YAHPBD@Z)
.\Debug/ListHandles.exe : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://d:\Snippet\BookCode\Windows_Codes\ListHandles\Debug\BuildLog.htm"
ListHandles - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

자... ^^; 이제 다시 "Use MFC in a Shared DLL" 옵션을 원래의 "Use Standard Windows Libraries"으로 돌려놓습니다. 참, 재미있게도... 이젠 정상적으로 프로젝트가 컴파일되어집니다. ^^






[최초 등록일: ]
[최종 수정일: 11/22/2022]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  8  9  [10]  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13693정성태7/24/20247244개발 환경 구성: 717. Visual Studio - C# 프로젝트에서 레지스트리에 등록하지 않은 COM 개체 참조 및 사용 방법파일 다운로드1
13692정성태7/24/20248026디버깅 기술: 199. Windbg - 리눅스에서 뜬 닷넷 응용 프로그램 덤프 파일에 포함된 DLL의 Export Directory 탐색
13691정성태7/23/20247385디버깅 기술: 198. Windbg - 스레드의 Win32 Message Queue 정보 조회
13690정성태7/23/20247019오류 유형: 919. Visual C++ 리눅스 프로젝트 - error : ‘u8’ was not declared in this scope
13689정성태7/22/20248526디버깅 기술: 197. Windbg - PE 포맷의 Export Directory 탐색
13688정성태7/21/20247630닷넷: 2281. C# - Lock / Wait 상태에서도 일부 Win32 메시지 처리파일 다운로드1
13687정성태7/19/20248060닷넷: 2280. C# - PostThreadMessage로 보낸 메시지를 Windows Forms에서 수신하는 방법파일 다운로드1
13686정성태7/19/20247855오류 유형: 918. Visual Studio - ATL Simple Object 추가 시 error C2065: 'IDR_...': undeclared identifier
13685정성태7/19/20248002스크립트: 66. Windows 디렉터리 경로를 WSL의 /mnt 포맷으로 구하는 방법 - 두 번째 이야기
13684정성태7/19/20248181닷넷: 2279. C# - 문자열 보간식 사례 (예: 조건 연산자 사용)
13683정성태7/18/20247651오류 유형: 917. ClrMD - Linux 환경의 .NET 5 덤프 분석 시 hang 현상
13682정성태7/18/20247869닷넷: 2278. WPF - 스레드에 종속되는 DependencyObject파일 다운로드1
13681정성태7/17/20247471닷넷: 2277. C# 13 - (2) 메서드 그룹의 자연 타입 개선 (메서드 추론 개선)파일 다운로드1
13680정성태7/16/20247857닷넷: 2276. C# - Method Group, Natural Type, function_type파일 다운로드1
13679정성태7/16/20246935Linux: 76. Linux - C++ (getaddrinfo 등을 담고 있는) libnss 정적 링크
13678정성태7/15/20247065VS.NET IDE: 191. Visual Studio 2022 - .NET 5 프로젝트를 Docker Support로 실행했을 때 오류
13677정성태7/15/20247156오류 유형: 916. MSBuild - CheckEolTargetFramework (warning NETSDK1138)
13676정성태7/14/20247328Linux: 75. gdb에서 glibc의 함수에 Breakpoint 걸기
13675정성태7/13/20249122C/C++: 166. C/C++ - DLL에서 template 함수를 export하는 방법 [1]파일 다운로드1
13674정성태7/13/20248003오류 유형: 915. Unhandled Exception: Microsoft.Diagnostics.NETCore.Client.ServerNotAvailableException: Unable to connect to Process
13673정성태7/11/20248444닷넷: 2275. C# 13 - (1) 신규 이스케이프 시퀀스 '\e'파일 다운로드1
13672정성태7/10/20247153닷넷: 2274. IIS - (프로세스 종료 없는) AppDomain Recycle
13671정성태7/10/20247264오류 유형: 914. Package ca-certificates is not installed.
13669정성태7/9/20247381오류 유형: 913. C# - AOT StaticExecutable 정적 링킹 시 빌드 오류
13668정성태7/8/20247399개발 환경 구성: 716. Hyper-V - Ubuntu 22.04 Generation 2 유형의 VM 설치
13667정성태7/7/20246622닷넷: 2273. C# - 리눅스 환경에서의 Hyper-V Socket 연동 (AF_VSOCK)파일 다운로드1
1  2  3  4  5  6  7  8  9  [10]  11  12  13  14  15  ...