APUE를 배우고 소스 코드를 컴파일하기 시작합니다.
1에서 소스 코드를 다운로드 소스 코드를
2, 그것을 추출
$ pwd
/Users/me/Desktop/PubRepo/C/APUE/apue.3e
3, readmd를 읽으십시오
$ cat readme
Read the file called DISCLAIMER.
On Freebsd, type "gmake".
On other platforms, type "make" (as long as this is gnu make).
For FAQs, updated source code, and the lost chapter, see http://www.apuebook.com.
Please direct questions, suggestions, and bug reports to sar@apuebook.com.
Steve Rago
January 2013
make버전을 확인했습니다
$ make --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0
4,하지만 오류를보고하지만 :
gcc -ansi -I../include -Wall -DMACOS -D_DARWIN_C_SOURCE -c -o sleep.o sleep.c
making intro
gcc -ansi -I../include -Wall -DMACOS -D_DARWIN_C_SOURCE getcputc.c -o getcputc -L../lib -lapue
ld: archive has no table of contents file '../lib/libapue.a' for architecture x86_64
clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
make[1]: *** [getcputc] Error 254
make: *** [all] Error 1
cp ./lib/error.c /usr/local/include/
$ cp ./lib/error.c / usr / local / include / 를 추가하는 답을 찾았습니다.
깨끗하게하다
making intro
gcc -ansi -I../include -Wall -DMACOS -D_DARWIN_C_SOURCE getcputc.c -o getcputc -L../lib -lapue
ld: archive has no table of contents file '../lib/libapue.a' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [getcputc] Error 1
make: *** [all] Error 1
여전히 오류가 있습니다.
어떻게 신청할 수 apue.h있습니까?
어떤 버전의 macOS 및 Xcode가 있습니까? (Sierra / code 8에서 작동합니다) 변경 사항을 어디서 얻었습니까?
—
Mark
macOS Mojave 및 Xcode가없는 최신 명령 줄. @Mark
—
대수