Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: fatal error: 'TargetConditionals.h' not found when I test if SFML works  (Read 3430 times)

0 Members and 1 Guest are viewing this topic.

hubertZK

  • Newbie
  • *
  • Posts: 2
    • View Profile
I'm new to SFML and C++. I followed official tutorials of Xcode on MacOS and it worked. But I want to code on VS Code.  I was just trying to test if SMFL works on VS Code.

This is my code:
#include <SFML/Graphics.hpp>
using namespace sf;

int main(){
    RenderWindow window(VideoMode(320,480),"The Game!");
    return 0;
}

When I'm trying to build tasks, I get this:
Executing task: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -g /Users/xxx/projects/simple_project/teris/main.cpp -o /Users/Cyxzk/projects/simple_project/teris/main -I /Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include <
In file included from /Users/xxx/projects/simple_project/teris/main.cpp:1:
In file included from /Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include/SFML/Graphics.hpp:32:
In file included from /Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include/SFML/Window.hpp:32:
In file included from /Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include/SFML/System.hpp:32:
/Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include/SFML/Config.hpp:52:14: fatal error: 'TargetConditionals.h' file not found
    #include "TargetConditionals.h"
1 error generated.

My OS: macOS Catalina10.15.3    My compiler:clang11.0.0

In my tasks.json, I add two lines in args:
 "-I",
 "/Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include"

In c_cpp_properties.json, I add one line in "includePath":
"/Users/xxx/Documents/externalLib/SFML-2.5.1-macos-clang/include"

Do I miss this file on my PC? Or do I need to link dylib or something else?

hubertZK

  • Newbie
  • *
  • Posts: 2
    • View Profile
Does anyone use VS Code on Mac as a platform to compile SFML?

jl1532

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
I'm using vscode on a Mac, everything works fine until I updated the OS last night... Still working on it...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
It can't find TargetConditionals.h.

Google lists quite a few answers when I search for fatal error: 'TargetConditionals.h' file not found maybe you can try to look at some of those responses.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything