MingW를 사용하여 FreeType 2 라이브러리를 연결할 수 없습니다.ld.exe : -lfreeType을 찾을 수 없습니다

StackOverflow https://stackoverflow.com/questions/6091982

문제

Windows 7에서 MingW로 컴파일하고, 코드 :: 블록을 IDE로 사용합니다. 모든 것이 최신이어야합니다. 나는 비슷한 질문이 많이 있지만, 정적 라이브러리를 컴파일하지 않고 동적 라이브러리를 연결하는 것으로 보이는 것처럼 보였습니다.

OpenGL에서 텍스트를 사용할 수 있도록 FTGL을 사용하려고합니다. FTGL은 FreeType 2를 설치해야합니다. freeType 소스를 다운로드 한 다음 mingw32-make.exe를 사용하여 cmd.exe에서 정적 라이브러리를 빌드하는 install.gnu 지침을 따랐습니다.

표시된 지침에 따라 FreeType 설치의 기본 디렉토리에서 mingw32-make를 실행했습니다. 콘솔 출력은 예상대로였습니다.

D:\freetype-2.4.4>mingw32-make

FreeType build system -- automatic system detection

The following settings are used:

  platform                     win32
  compiler                     gcc
  configuration directory      .\builds\win32
  configuration rules          .\builds\win32\w32-gcc.mk

If this does not correspond to your system or settings please remove the file
'config.mk' from this directory then read the INSTALL file for help.

Otherwise, simply type 'make' again to build the library.
or 'make refdoc' to build the API reference (the latter needs python).

Could Not Find D:\freetype-2.4.4\objs\ftmodule.h
Generating modules list in ./objs/ftmodule.h...
"* module: truetype  (Windows/Mac font files with extension *.ttf or *.ttc)"
"* module: type1     (Postscript font files with extension *.pfa or *.pfb)"
"* module: cff       (OpenType fonts with extension *.otf)"
"* module: cid       (Postscript CID-keyed fonts, no known extension)"
"* module: pfr       (PFR/TrueDoc font files with extension *.pfr)"
"* module: type42    (Type 42 font files with no known extension)"
"* module: winfnt    (Windows bitmap fonts with extension *.fnt or *.fon)"
"* module: pcf       (pcf bitmap fonts)"
"* module: bdf       (bdf bitmap fonts)"
"* module: sfnt      (helper module for TrueType & OpenType formats)"
"* module: autofit   (automatic hinting module)"
"* module: pshinter  (Postscript hinter module)"
"* module: raster    (monochrome bitmap renderer)"
"* module: smooth    (anti-aliased bitmap renderer)"
"* module: smooth    (anti-aliased bitmap renderer for LCDs)"
"* module: smooth    (anti-aliased bitmap renderer for vertical LCDs)"
"* module: psaux     (Postscript Type 1 & Type 2 helper module)"
"* module: psnames   (Postscript & Unicode Glyph name handling)"
done.
.

플랫폼과 컴파일러가 올바른 것으로 보이는 것으로 보는 것으로, 나는 make 명령을 다시 실행했다 :

D:\freetype-2.4.4>mingw32-make
(bunch of calls, building objects then linking them, until:)
ar: creating objs/freetype.a
.

D : \ FreeType-2.4.4 \ objs 디렉토리에서 freeType 파일 파일을 생성했습니다.

i는 코드 :: 블록의 단계를 프로젝트에 연결하여 FTGL을 테스트하고 빌드하려고 시도한 코드의 샘플 비트를 추가했습니다.

나는 일을하려고하는 방법에 따라 두 가지 오류가 있습니다.

링커 (-ld : \ freetype-2.4.4 \ objs)에 올바른 디렉토리를 제공하고 -LFreeType 링크를 제공하면 LD.exe가 제목의 오류가 발생할 때까지 모든 것이 좋습니다. 찾을 수 없습니다 - lfreeType.

올바른 디렉토리를 제공하지 않으면 동일한 오류가 발생합니다. 라이브러리를 찾을 수 없습니다.

FREETYPE.A, FREETYPE.A를 libfreetype.a로 변경하고 올바른 디렉토리를 제공하면 대신 몇 가지 정의되지 않은 참조를 얻습니다.

obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x250): undefined reference to `FTPixmapFont::FTPixmapFont(char const*)'
obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x258): undefined reference to `FTFont::Error() const'
obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x274): undefined reference to `FTFont::FaceSize(unsigned int, unsigned int)'
obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x308): undefined reference to `FTFont::Render(char const*, int, FTPoint, FTPoint, int)'
obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x316): undefined reference to `FTPixmapFont::~FTPixmapFont()'
obj\Release\CApp_OnRender.o:CApp_OnRender.cpp:(.text+0x328): undefined reference to `FTPixmapFont::~FTPixmapFont()'
collect2: ld returned 1 exit status
.

잘못된 디렉토리를 제공하면 다시 라이브러리를 찾을 수없는 이전 오류가 발생했습니다.

설치 파일의 지시 사항을 따르면 LIB로 시작하지 않은 이름을 가진 라이브러리를 생성 할 것입니다. 나는 체크되었고 모든 다른 하나의 다른 .a 파일이 lib-로 시작되었습니다. 링커가 libfreeetype 파일을 찾고있는 것처럼 보입니다. 그렇다면 왜 FreeType.a를 만드는 것입니까? 이것은 프로그램을 컴파일하는 데 사용하는 라이브러리에 대해 동일한 컴파일러를 사용하고 있습니다.

어쨌든, 여기에서 어디로 가야하는지 확실하지 않습니다. 나는 MingW 패키지의 일부인 MSYS 쉘을 사용하는 것으로 생각되었지만, 나는 그것에 대한 많은 경험이없고 설치에 대한 지침은 더 명백한 명령을 알고 있다고 가정합니다. 그들은 옵션이 무엇인지에 대한 언급없이 ./configure [옵션]을 사용하여 언급합니다. 아마도 시스템에 대한 더 많은 지식을 가진 누군가에게는 누군가에게 분명하지만, MSYS는 SH의 첫 경험입니다.

이 문제에 대한 도움을 주셔서 감사합니다.

도움이 되었습니까?

해결책

내 버전의 libfreetype.a (2.4.4, 수정 된 데비안 패키지에서 구축 된)는 링커가 찾고있는 기호를 내보내지 않으며 (ftpixmapfont 생성자) 헤더는 그러한 클래스를 선언하지 않습니다.빠른 Google 검색은 FTGL에 속해 있음을 나타냅니다.

import 파일 이름을 libfreetype로 바꾸려면 올바르지 않았습니다 (mingw ld는 그렇지 않으면 i를 찾지 못할 것입니다). 또한 필요한 ftgl 라이브러리에 링크 했습니까?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top