티스토리 뷰


[문제 상황]
파이썬 문서(http://docs.python.org/extending/windows.html)에 나와있는 대로 따라하는 과정에서 문제가 발생하였다. (컴파일 환경은 Python 3.1 및 Visual C++ 2008 Pro.)
해당 파이썬 문서에는 다음과 같은 내용이 있다. 아주 간편해 보인다.



4. Building C and C++ Extensions on Windows

// 중략..

To build extensions using these instructions, you need to have a copy of the Python sources of the same version as your installed Python. You will need Microsoft Visual C++ “Developer Studio”; project files are supplied for VC++ version 7.1, but you can use older versions of VC++. Notice that you should use the same version of VC++that was used to build Python itself. The example files described here are distributed with the Python sources in the
PC\example_nt\ directory.

  1. Copy the example files — The example_nt directory is a subdirectory of the PC directory, in order to keep all the PC-specific files under the same directory in the source distribution. However, the example_nt directory can’t actually be used from this location. You first need to copy or move it up one level, so that example_nt is a sibling of the PC and Include directories. Do all your work from within this new location.

  2. Open the project — From VC++, use the File ‣ Open Solution dialog (not File ‣ Open!). Navigate to and select the file example.sln, in the copy of the example_nt directory you made above. Click Open.

  3. Build the example DLL — In order to check that everything is set up right, try building:

  4. Select a configuration. This step is optional. Choose Build ‣ Configuration Manager ‣ Active Solution Configuration and select either Release or Debug. If you skip this step, VC++ will use the Debug configuration by default.

  5. Build the DLL. Choose Build ‣ Build Solution. This creates all intermediate and result files in a subdirectory called either Debug or Release, depending on which configuration you selected in the preceding step.


// 생략..


하지만 막상 example_nt 폴더 안의 솔루션을 열어서 빌드해 보면 다음과 같은 에러가 발생한다.


"LINK : error LNK2001: unresolved external symbol initexample"

여기서 막혀 다음 단계로 나아갈 수가 없었다.




[해결 방법]
웹 문서를 뒤적이다가 페이지 하나 를 발견하였다. 내가 하고 싶은 질문과 받고 싶은 답변이 그대로 수록되어 있다. 아주 간단한 해결책이었다.

Project -> Properties -> Configuration Properties -> Linker -> Command Line에서,
Additional options에 있는 '/export:initexample
' 부분을 삭제해 준 다음 컴파일하면 해당 에러가 발생하지 않는다.



댓글