-1

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?

enter image description here

Gummysaur
  • 96
  • 7
  • Don't include the .hpp files in the compiler arguments. They should not be source files and won't help the linker errors. – drescherjm Feb 08 '23 at 19:16
  • The macOS instructions are here: [https://code.visualstudio.com/docs/cpp/config-clang-mac#_modifying-tasksjson](https://code.visualstudio.com/docs/cpp/config-clang-mac#_modifying-tasksjson) – drescherjm Feb 08 '23 at 19:17
  • Your problem is you are not actually linking to the SFML libraries. This question should help: [https://stackoverflow.com/questions/55406142/is-there-a-way-to-link-sfml-libraries-in-vscode-mac](https://stackoverflow.com/questions/55406142/is-there-a-way-to-link-sfml-libraries-in-vscode-mac) observe the `-l` and `-L` options in the answers. `-L folderPath` specifies a library folder. `-l libnane` links to a library – drescherjm Feb 08 '23 at 19:17

1 Answers1

1

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.

Gummysaur
  • 96
  • 7