只是为了快速术语:
#basic makefile rule
target: dependencies
recipe
Run Code Online (Sandbox Code Playgroud)
例如,我希望转此:
#one of my targets
file.o: file.cpp 1.h 2.h 3.h 4.h 5.h 6.h 7.h 8.h another.h lots.h evenMore.h
$(COMPILE)
Run Code Online (Sandbox Code Playgroud)
进入:
#one of my targets
file.o: $(GENERATE)
$(COMPILE)
Run Code Online (Sandbox Code Playgroud)
而且我不太确定它是否可能......
我可以使用这个编译器标志:
g++ -MM file.cpp
Run Code Online (Sandbox Code Playgroud)
它将返回正确的目标和依赖.
所以从示例中,它将返回:
file.o: file.cpp 1.h 2.h 3.h 4.h 5.h 6.h 7.h 8.h another.h lots.h evenMore.h
Run Code Online (Sandbox Code Playgroud)
但是,'make'不允许我在规则的目标或依赖部分中显式编写shell代码:(
我知道有一个'make'函数叫做shell
但我不能完全插入这个依赖并解析魔法,因为它依赖于表示目标的宏$ @或者至少我认为这就是问题所在
我甚至尝试用这个makefile函数替换"file.cpp"依赖项,但这也无效.
#it's suppose to turn the $@ (file.o) into file.cpp
THE_CPP := $(addsuffix $(.cpp),$(basename $@))
#one of my targets …Run Code Online (Sandbox Code Playgroud) 我想为STM32F217IG微控制器创建一个项目.
然后我安装了Eclipse和GNU for ARM嵌入式GCC交叉编译器.我不认为这是Code Sourcery.我使用它,因为它支持浮点,而Code Sourcery则不支持.
一旦我这样做,我尝试创建一个只有两个源文件的真正小项目:test.c和main.c,只写入两个:
#include <stdlib.h>
#include <stdio.h>
int main (void)
{
printf("Hello, World!");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我更改了项目属性中的line命令,用arm-none-eabi-gcc替换GCC,然后尝试编译项目.
我自己没有创建任何make文件; 我在Eclipse中使用了自动创建.
这个建筑看起来很好,但是当谈到链接器时,我在控制台中遇到了以下错误:
make all
'Building target: test3'
'Invoking: Cross GCC Linker'
arm-none-eabi-gcc -o"test3" ./main.o ./test3.o
c:/program files/gnu tools arm embedded/4.6 2012q4/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): In function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
c:/program files/gnu tools arm embedded/4.6 2012q4/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'
c:/program files/gnu tools arm embedded/4.6 2012q4/bin/../lib/gcc/arm-none-eabi/4.6.2/../../../../arm-none-eabi/lib\libc.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x20): undefined reference to …Run Code Online (Sandbox Code Playgroud) 环境:采用Windows XP SP2的惠普笔记本电脑
我使用GnuPG(gpg)为Windows创建了一些加密文件.昨天,我的硬盘出现故障,所以我重新映像了硬盘.我现在重新安装了gpg并使用与之前相同的密码重新生成了我的密钥.但是,我现在无法解密文件.我收到以下错误:
C:\sureshr>gpg -a c:\sureshr\work\passwords.gpg
gpg: encrypted with 1024-bit ELG-E key, ID 279AB302, created 2008-07-21
"Suresh Ramaswamy (AAA) BBB"
gpg: decryption failed: secret key not available
C:\sureshr>gpg --list-keys
C:/Documents and Settings/sureshr/Application Data/gnupg\pubring.gpg
--------------------------------------------------------------------
pub 1024D/80059241 2008-07-21
uid Suresh Ramaswamy (AAA) BBB
sub 1024g/279AB302 2008-07-21
AAA = gpg评论
BBB =我的电子邮件地址
我确信我使用的是正确的密码.这个错误究竟是什么意思?我如何告诉gpg在哪里找到我的密钥?
谢谢,
苏雷什
我将使用什么GNU/Linux命令行工具来执行文件的搜索和替换?
可以用正则表达式格式指定搜索文本和替换吗?
我有一个工作的链接器脚本.我想添加另一个数据部分,其内容直接从文件中提取(ld不应该解析它并提取部分等等).我怎样才能做到这一点?
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS
{
.text 0x100000 : {
*(.multiboot)
*(.text)
*(.code)
*(.rodata*)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
kernel_end = .;
roottask_start = .;
.data : {
HERE I WANT TO INCLUDE THE ENTIRE CONTENTS OF ANOTHER (BINARY) FILE
}
roottask_end = .;
}
Run Code Online (Sandbox Code Playgroud) 在GNU屏幕中,我想更改默认命令绑定到Alt-s(通过调整.screenrc)而不是默认的Ca,原因是我使用emacs因此GNU屏幕绑定Ca键,发送"Ca"到emacs变成乏味(如@Nils所说,发送"Ca"我应该键入"Ca a"),以及bash shell中的"Ca",我可以将转义更改为C-但是其中一些已经映射到emacs和其他组合并不像ALT-s那么容易.如果有人已经完成了ALT键映射,请告诉我.
我需要popen在项目中使用,但我得到:
error: 'popen' was not declared in this scope
看起来GCC __STRICT_ANSI__在两者之下定义-std=c++0x(与我能够找到的信息相反)-std=gnu++0x,这导致popen(和_popen)被省略stdio.奇怪的是,取消定义__STRICT_ANSI__并不能解决问题,也不会向前宣布该功能.我显然错过了一些东西.有合理的解决方法吗?
我使用的是MinGW 4.5.0,并升级到4.5.2,但我仍然遇到同样的问题.我宁愿不必使用msys来编译4.6.0,但如果必须的话,我会这样做.
我想使用CPU_SET,这是一个glibc linux特定的宏,应该在sched.h man手册页中清楚地说明_GNU_SOURCE必须定义以便定义宏.但是,查看标题CPU_SET仅在__USE_GNU定义时定义(有#ifdef保护).几年前我似乎记得那_GNU_SOURCE是必要的.
问题:
1)显然,联机帮助页已关闭.如何通知维护者该联机帮助页不正确?
2)什么时候从过渡_GNU_SOURCE到__USE_GNU发生(无论是在版本或时间方面)
3)是否存在较新版本的glibc仍在使用的情况_GNU_SOURCE?或者我可以安全地假设定义__USE_GNU是足够的吗?
我正在尝试为ubuntu安装gnu arm工具链.我首先从CodeSourcery下载了tar.但是当我进入bin文件夹时,我无法运行任何二进制文件.我已经尝试过./而没有把它放在PATH中,它一直告诉我"Command not Found"但文件就在我面前的文件夹中.然后我尝试了sudo apt-get install gcc-arm-linux-gnueabi,除非它说已成功安装,我找不到它的地方gcc-arm-linux-gnueabi.有人可以帮忙吗?
我在目标文件(例如)上运行GDB,我想根据几个命令检查它.如何根据文件中的行执行这些命令(而不是输入每个运行的GDN)?exeFile
例如 - 我想设置中断 -
break *0x8048e19
break *0x8048e32
break *0x8048e6f
break *0x8048e90
Run Code Online (Sandbox Code Playgroud)
所以我想将它们保存在一个文件中然后告诉GDB从这个文件中执行它们.