哈佛CS50库,需要帮助,在Mac OS X上安装 [英] Harvard CS50 Library , Need Help Installing on Mac OS X
问题描述
我要从哈佛扩展学校cs50.tv上这门课,并且在此过程中,他们正在使用他们制作的名为cs50的库,可通过该链接下载
I'm taking this course from cs50.tv, which is Harvard extension school and in the course they are using a library they made called cs50 , on this link its available for download
https://manual.cs50.net/CS50_Library#Mac_OS
我下载了zip文件并将其解压缩,然后打开终端并通过cd进入库目录,但是每次我都按照手册中的步骤进行操作.
I downloaded the zip file and unzipped it, and then I open the terminal and cd my way to the library directory, but every time I follow the steps in the manual.
执行此命令后,立即执行gcc -c -ggdb -std = c99 cs50.c -o cs50.o
Right after I do this command gcc -c -ggdb -std=c99 cs50.c -o cs50.o
我在终端中收到此错误
cs50.c:15:16: error: gc.h: No such file or directory
cs50.c: In function ‘GetString’:
cs50.c:207: warning: implicit declaration of function ‘GC_FREE’
cs50.c:212: warning: implicit declaration of function ‘GC_REALLOC’
cs50.c:212: warning: initialization makes pointer from integer without a cast
cs50.c:230: warning: implicit declaration of function ‘GC_MALLOC’
cs50.c:230: warning: initialization makes pointer from integer without a cast
如果有人可以提供帮助,我将非常感谢.
Would really appreciate if anyone can help.
推荐答案
如果尝试使用gcc编译cs50.h库,我发现在大多数现代64位Mac上都无法成功. Xcode 4.x通常需要64位兼容的库格式. GCC尚未更新为包括64位目标文件. Clang/LLVM是gcc的一种新兴替代方案,Apple将Xcode用作Clang/LLVM的首选编译器引擎.我还没有亲自尝试过,但是将探索Xcode为Xcode生成兼容的库.我正在edX上参加Harvardx cs50x课程,即使对有经验的程序员来说,这也是很棒的课程. cs50.h库很有趣,因为它为各种变量类型(例如,变量类型)提供了相对健壮的I/O例程.字符串,整数.为c编程语言浮动,包括对缓冲区溢出攻击的良好保护.
If you trying to use gcc to compile the cs50.h library, I have found that to be unsuccessful on most modern 64 bit macs. Xcode 4.x generally wants a 64 bit compatible library format. GCC has not been updated to include 64 bit object files. Clang/LLVM is a rising alternative to gcc, and is used by Apple for Xcode as their preferred compiler engine. I have not personally tried it yet, but will be exploring Xcode to produce a compatible library for Xcode. I am taking the Harvardx cs50x course at edX, and it is great course, even for experienced programmers. The cs50.h library is interesting, because it provides relatively robust I/O routines for various variable types, e.g. String, Integer. float for the c programming language, including good protection for buffer overflow attacks.
这篇关于哈佛CS50库,需要帮助,在Mac OS X上安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!