首页 \ 问答 \ “链接器输入文件未使用,因为链接未完成”是什么意思?(What does “linker input file unused because linking not done” mean? (C makefile))

“链接器输入文件未使用,因为链接未完成”是什么意思?(What does “linker input file unused because linking not done” mean? (C makefile))

我已经创建了一个makefile来编译和链接我的程序,但是,我无法弄清楚为什么我会收到此错误。 这与SDL有关吗?

GCC = gcc
CFLAGS = -c -std=c99 -lm -Wall -Wextra -pedantic -O3 -Wfloat-equal -g
SDL = -lSDL2 -lSDL2_ttf -lSDL2_image -lSDL2_mixer

all: ./game

game: global.o display.o player.o entities.o controls.o sound.o menu.o
    $(GCC) $(CFLAGS) global.o display.o player.o entities.o controls.o sound.o menu.o -o game

global.o: global.c
    $(GCC) $(CFLAGS) $(SDL) global.c

display.o: display.c
    $(GCC) $(CFLAGS) $(SDL) display.c

player.o: player.c
    $(GCC) $(CFLAGS) $(SDL) player.c

entities.o: entities.c
    $(GCC) $(CFLAGS) $(SDL) entities.c

controls.o: controls.c
    $(GCC) $(CFLAGS) $(SDL) controls.c

sound.o: sound.c
    $(GCC) $(CFLAGS) $(SDL) sound.c

menu.o: menu.c
    $(GCC) $(CFLAGS) $(SDL) menu.c

clean:
    rm *o game

I have created a makefile to compile and link my program, however, I can't figure out why I am getting this error. Is it to do with SDL?

GCC = gcc
CFLAGS = -c -std=c99 -lm -Wall -Wextra -pedantic -O3 -Wfloat-equal -g
SDL = -lSDL2 -lSDL2_ttf -lSDL2_image -lSDL2_mixer

all: ./game

game: global.o display.o player.o entities.o controls.o sound.o menu.o
    $(GCC) $(CFLAGS) global.o display.o player.o entities.o controls.o sound.o menu.o -o game

global.o: global.c
    $(GCC) $(CFLAGS) $(SDL) global.c

display.o: display.c
    $(GCC) $(CFLAGS) $(SDL) display.c

player.o: player.c
    $(GCC) $(CFLAGS) $(SDL) player.c

entities.o: entities.c
    $(GCC) $(CFLAGS) $(SDL) entities.c

controls.o: controls.c
    $(GCC) $(CFLAGS) $(SDL) controls.c

sound.o: sound.c
    $(GCC) $(CFLAGS) $(SDL) sound.c

menu.o: menu.c
    $(GCC) $(CFLAGS) $(SDL) menu.c

clean:
    rm *o game

原文:https://stackoverflow.com/questions/34426362
更新时间:2022-02-18 12:02

最满意答案

是的,可以在EXCEPTION块中使用COMMITROLLBACKROLLBACK特别是与保存点结合使用时,比COMMIT更常见。 在大多数应用程序中肯定不会发生COMMIT 。 我当然不会在EXCEPTION块中的任何地方使用COMMIT ,除了最外层的代码。


Yes it's possible to use either COMMITor ROLLBACK in an EXCEPTION block. ROLLBACK especially when combined with a save point, is much more common than COMMIT. COMMIT certainly is not expected in most apps. I certainly wouldn't use a COMMIT in an EXCEPTION block anywhere except at the outermost layer of code.

相关问答

更多
  • 在得到类似的问题并浪费了几个小时后,我想出了如何调试这种情况。 出于某种原因,@ transaction.commit_manually装饰器会使发生在函数中的异常无效。 暂时从你的函数中删除装饰器,你现在会看到异常,修复它,并把装饰器放回去! After getting a similar issue and wasting hours on it I figured out how to debug this situation. For some reason the @transaction.com ...
  • 您不能在函数中使用SAVEPOINT , COMMIT或ROLLBACK等事务语句。 在PL / pgSQL中启动块的BEGIN与启动事务的SQL语句BEGIN不同。 只需从函数中删除COMMIT ,就可以得到解决方案:因为整个函数总是在单个事务中运行,所以第三个语句中的任何错误都将导致ROLLBACK也撤消前两个语句。 You cannot use transaction statements like SAVEPOINT, COMMIT or ROLLBACK in a function. The BE ...
  • 他们两个似乎都和我一模一样 那是错的。 按定义进行的事务是Atomic本质上意味着它将发生并成功执行组中的所有命令或根本不执行任何命令。 如果它成功并且您想要保持更改,那么COMMIT else如果组中的任何语句失败,那么ROLLBACK将返回到原始状态。 所以在你的情况下,你会希望所有下面的语句成功执行,如果然后COMMIT持续更改,但如果任何语句因任何所谓的原因而失败,那么它可能最终会产生一个不想要的结果,你不应该我想坚持,所以ROLLBACK并回到以前的一致状态。 $sth1 = $dbh->exec ...
  • 虽然开始/结束事务不能在PL / pgSQL过程中使用,但您可以抛出异常并处理它。 样品: CREATE TABLE public.test ( id serial, description character(255) ) WITH ( OIDS=FALSE ); CREATE OR REPLACE FUNCTION insert_test(IN _description text, IN _rollback boolean DEFAULT false, OUT result integer ...
  • 检索$dbConnection->insert_id BEFORE commit() Retrieve $dbConnection->insert_id BEFORE commit()
  • 事实证明,在模板渲染过程中,有数据库访问,所以通常的模式如: return render_to_response('mainapp/templates/incorporate.html', RequestContext(request, form_params)) 是问题的原因。 我需要将其替换为: retval = render_to_response('mainapp/templates/incorporate.html', ...
  • 我认为这段代码是错误的,因为如果任何查询失败并且$ all_query_ok == false,那么您不需要执行回滚,因为事务未被处理。 我对吗? 不,如果单个SQL语句失败,则事务不会跟踪。 如果单个SQL语句失败,则语句将被回滚(就像在@ eggyal的答案中描述的那样) - 但事务仍处于打开状态。 如果现在调用commit ,则不会回滚成功的语句,只是将“损坏的”数据插入到数据库中。 您可以轻松地重现: m> CREATE TABLE transtest (id INT NOT NULL PRIMAR ...
  • 是的,可以在EXCEPTION块中使用COMMIT或ROLLBACK 。 ROLLBACK特别是与保存点结合使用时,比COMMIT更常见。 在大多数应用程序中肯定不会发生COMMIT 。 我当然不会在EXCEPTION块中的任何地方使用COMMIT ,除了最外层的代码。 Yes it's possible to use either COMMITor ROLLBACK in an EXCEPTION block. ROLLBACK especially when combined with a save p ...
  • 您的问题描述表明您有一大组较小的逻辑事务(每个新ID都是事务)。 您应该提交每个逻辑事务。 等待完成整套交易的两个原因是: 如果整个事务集实际上是一个事务本身 - 所有插入操作都必须成功执行任何行。 在这种情况下,你的小型“交易”不是真正的交易。 您的批量加载过程中没有重新启动功能,实际上这是第1项的特例。如果批量加载过程中止,则需要一种方法来成功跳过应用的ID。 Tom Kyte的建议是承诺每个逻辑工作单元 - 交易。 Your problem description indicates you have ...
  • 您无法回滚已提交的更改。 就像你的其他问题代码块3是要走的路。 即使提交可能失败,它也不会因为常见错误(例如错误的语法或约束违规或其他原因)而失败。 假设整个PHP进程可能在两次提交之间被杀死,重置后者让你没有机会修复代码中产生的错误。 但是,您将不得不单独处理这些罕见的异常(例如备份),因为我没有看到有效的方式来处理它们的代码。 还要记住,提交更改时已经应用但尚未“发布”。 所以提交本身很少会失败(只是出于特殊原因)。 @EDIT 1 你处理错误的方式取决于你如何设置你的PDO实例。 请参阅有关PDO如何 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)