英文:
How to link multiple files in the tasks.json in VSCode
问题
我尝试链接和编译两个文件夹。一个包含我项目的所有cpp文件,另一个是SFML图形库。VSCode可以正常找到它,路径名都是正确的,但当我将tasks.json更改为下面的图像时,我会收到错误消息“无法在生成多个输出文件时指定-o”,尽管只指定了一个输出文件。
我无法找到在线帮助,尽管这似乎是你需要做的常见事情。有人可以帮忙吗?
英文:
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?
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论