如果我们有两个.c文件和一个.h文件:main.c sub.c sub.h,其中
main.c中
#include "sub.h"
...
Run Code Online (Sandbox Code Playgroud)
sub.c
#include "sub.h"
...
Run Code Online (Sandbox Code Playgroud)
我们可以编译程序,或者i)
gcc -o a.out main.c sub.c
Run Code Online (Sandbox Code Playgroud)
或ii)
gcc -c main.c
gcc -c sub.c
gcc -o a.out main.o sub.o
Run Code Online (Sandbox Code Playgroud)
鉴于这种情况,预处理器输出一个或两个翻译单元吗?
我很困惑,因为:main.c包含sub.h,意味着预处理器将输出一个编译单元.另一方面,创建了两个目标文件,main.o并且sub.o在创建可执行文件之前,让我认为"两个源文件因此有两个翻译单元".
我误解了哪一部分?或者我在哪里犯错误?
我试图在VHDL中使用'浮点和定点包'作为我的滤波器设计的一部分.我使用Altera Quartus II作为开发环境.我从以下网站下载了文件包:http://www.vhdl.org/fphdl/,现可在http://web.archive.org/web/20160305202256/http://www.vhdl.org/fphdl上找到/
在他们的用户指南中,提到了以下内容:
'fixed_float_types_c.vhdl', 'fixed_pkg_c.vhdl' and 'float_pkg_c.vhdl'
should be compiled into a library called "ieee_proposed".
Run Code Online (Sandbox Code Playgroud)
但是,我并不确切知道如何使用Altera Quartus II工具将提到的*.vhdl文件编译到库中.
任何提示将不胜感激.
我目前正在尝试在我的机器上安装GCC-4.1.2:Fedora 20.
在指令中,前三个命令涉及使用'sed'命令,用于Makefile修改.但是,我很难在我的案例中正确使用这些命令.GCC-4.1.2 的网站链接
命令是:
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in &&
sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in &&
Run Code Online (Sandbox Code Playgroud)
我试图通过阅读'sed'手册页来了解它们,但这样做并不容易.任何帮助/提示将不胜感激!
bash ×1
c ×1
fixed-point ×1
gcc ×1
intel-fpga ×1
makefile ×1
quartus ×1
sed ×1
shell ×1
vhdl ×1