我正在尝试使用 BFD 库,所以我安装了软件包 binutils-dev 并包含:
#include <bfd.h>
我正在从我的代码中调用 bfd_openr 和 bfd_close 等等。
最近我升级了软件包,现在我从这里得到一个错误:
bfd.h:
/* PR 14072: Ensure that config.h is included first. */
#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif
...我应该包括 config.h - 但我没有使用 autoconf。
我是否包含了错误的头文件?你应该如何使用 binutils-dev?
这是一个演示程序:
#include <stdio.h>
#include <bfd.h>
int main()
{
bfd_init();
bfd* file = bfd_openr("a.out", 0);
if (!file)
return -1;
if (bfd_check_format(file, bfd_object))
printf("object file\n");
else
printf("not object file\n");
bfd_close(file);
return 0;
}
尝试编译运行如下:
$ sudo apt-get install binutils-dev
$ gcc test.c
In file included from test.c:3:0:
/usr/include/bfd.h:37:2: error: #error config.h must be included before this header
最佳答案
嗯,使用 header 的最正确方法是在您的包中也使用 autotools。有些人就是固执,我认为您无能为力。
另一种方法是通过定义它正在使用的宏来解决检查问题:
#define PACKAGE 1
#define PACKAGE_VERSION 1
当然,如果您已经定义了这些,您也可以将它们设置为一些合理的值,例如:
#define PACKAGE "your-program-name"
#define PACKAGE_VERSION "1.2.3"
并将它们用于您的程序。您通常会在某个时候使用类似的东西来保持版本一致。
如果您使用的是符合标准的编译器,这应该足够了,因为那时将声明 __STDC__ 宏,一切都会正常进行。好吧,只要您使用的 header 不需要更多 autoconf 生成的定义。
例如,如果您想使用 plugin-api.h,您实际上必须处理对 stdint.h 和 inttypes.h 的检查...
关于c - binutils/bfd.h 现在想要 config.h 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11748035/
我一直致力于让我们的Rails2.3.8应用程序在JRuby下正确运行。一切正常,直到我启用config.threadsafe!以实现JRuby提供的并发性。这导致lib/中的模块和类不再自动加载。使用config.threadsafe!启用:$rubyscript/runner-eproduction'pSim::Sim200Provisioner'/Users/amchale/.rvm/gems/jruby-1.5.1@web-services/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:105:in`co
简而言之错误:NOTE:Gem::SourceIndex#add_specisdeprecated,useSpecification.add_spec.Itwillberemovedonorafter2011-11-01.Gem::SourceIndex#add_speccalledfrom/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91./opt/local/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/rails/gem_dependency.rb:275:in`==':und
我有1.8.6附带的VanillaMacOSXLeopard。我是RoR的新手,所以会学习网上的教程。在使用更高版本的Ruby时,我是否可能会发现遵循它们的问题?我目前正在查看提到1.8.6和1.8.7的这个-http://www.railstutorial.org/book 最佳答案 RoR教程对两者都适用,但如果您正在学习Ruby,则应该学习1.9。Rails3将不支持1.8.6,所以我会选择1.8.7或1.9。我还推荐使用RVM在Ruby版本之间切换。 关于ruby-on-rail
首先,这是我的版本:Greg-Nowickis-MacBook-Pro:sample_appGreg_Nowicki$ruby-vruby2.0.0p451(2014-02-24revision45167)[x86_64-darwin13.1.0]Greg-Nowickis-MacBook-Pro:sample_appGreg_Nowicki$rails-vRails4.0.4我正在学习HartlRails教程并安装rspec进行测试。我已将gem'rspec-rails'添加到我的gemfile中,当我运行railsgeneraterspec:install时,这就是我得到的:Gre
当我尝试在macOSMojave(10.14.1)上构建带有ruby支持(--enable-rubyinterp)的vim(8.1.0509)时,出现错误:Infileincludedfrom/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10:fatalerror:'ru
我正在尝试创建一个新的Rails项目,Jakes-Air:codeJakeWengroff$railsnewMyNewProject-T但我一直收到这个错误:script/rails:5:in`require':cannotloadsuchfile--/Users/JakeWengroff/config/boot(LoadError)fromscript/rails:5:in`'检查Ruby版本,ruby-v,我明白了ruby2.1.2p95(2014-05-08revision45877)[x86_64-darwin13.0]当我想检查Rails的版本时,rails-v,我得到了与我
我正在开发Rails5应用程序并使用Assets管道。它在开发模式下运行良好,但如果我尝试在生产模式下运行它,它无法正确加载图像和样式。我查了一下,发现是因为config.assets.compile=false在config/environments/production.rb中除非我将其设置为真,否则它根本不起作用。我知道实时编译不适合生产,有什么解决方案? 最佳答案 有两个与在Rails服务器中提供Assets相关的选项:Assets编译config.assets.compile=true指Assets编译。也就是说,当Rai
我正在编写一个Rails引擎,但我不确定如何扩展我的config/application.rb我想我必须以某种方式获取应用程序名称有什么想法吗?requireFile.expand_path('../boot',__FILE__)require'rails/all'#RequirethegemslistedinGemfile,includinganygems#you'velimitedto:test,:development,or:production.Bundler.require(:default,Rails.env)moduleapplication_nameclassAppli
在3.0之前有一种方法可以做到这一点:#...set:mysql_password,proc{Capistrano::CLI.password_prompt"Gimmeremotedatabaseserverpassword.Don'tworry,Iwon'ttellanyone:"}#...namespace:dbdodesc'Dumpremotedatabase'task:dumpdorun"mysqldump-u#{mysql_user}-p#{mysql_database}>~/#{mysql_database}.sql"do|channel,stream,data|ifdat
gem安装在MacOsMojave中失败。有什么可以帮助我解决这个问题的吗?我的ruby版本是ruby2.3.7p456。➜sudogeminstalljson-v'1.8.3'currentdirectory:/Library/Ruby/Gems/2.3.0/gems/json-1.8.3/ext/json/ext/generatormake"DESTDIR="compilinggenerator.cInfileincludedfromgenerator.c:1:Infileincludedfrom./../fbuffer/fbuffer.h:5:Infileincludedfr