如何在VSCode的tasks.json中链接多个文件

huangapple go评论73阅读模式
英文:

How to link multiple files in the tasks.json in VSCode

问题

我尝试链接和编译两个文件夹。一个包含我项目的所有cpp文件,另一个是SFML图形库。VSCode可以正常找到它,路径名都是正确的,但当我将tasks.json更改为下面的图像时,我会收到错误消息“无法在生成多个输出文件时指定-o”,尽管只指定了一个输出文件。

我无法找到在线帮助,尽管这似乎是你需要做的常见事情。有人可以帮忙吗?

如何在VSCode的tasks.json中链接多个文件

英文:

I'm trying to link and compile two folders. One has all the cpp files of my project, and the other is the SFML graphics library. VSCode can find it just fine and the pathnames are both correct, but when I change the tasks.json to the image below, I get the error "cannot specify -o when generating multiple output files", even though there's only one output file specified.

I can't find anything online to help me with this even though it seems like a common thing you'd need to do. Can anyone help?

如何在VSCode的tasks.json中链接多个文件

答案1

得分: 1

感谢您的评论。解决方案在@drescherjm提供的链接中;您需要将SFML路径添加到包含路径中,并将库链接更改为在输出文件之后。我不知道库与源文件链接方式不同。感谢您的帮助。

英文:

Thank you for the comments. The solution is in what @drescherjm linked; you have to put the SFML pathname into the include path and change the library link to be after the output file. I didn't know libraries were linked differently from source files. Thanks for the help.

huangapple
  • 本文由 发表于 2023年2月9日 03:01:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/75390550.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定