SFML community forums

Help => General => Topic started by: hubertZK on April 09, 2020, 03:18:42 am

Title: fatal error: 'TargetConditionals.h' not found when I test if SFML works
Post by: hubertZK on April 09, 2020, 03:18:42 am
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?
Title: Re: fatal error: 'TargetConditionals.h' not found when I test if SFML works
Post by: hubertZK on April 11, 2020, 02:40:05 am
Does anyone use VS Code on Mac as a platform to compile SFML?
Title: Re: fatal error: 'TargetConditionals.h' not found when I test if SFML works
Post by: jl1532 on April 29, 2021, 10:26:24 pm
I'm using vscode on a Mac, everything works fine until I updated the OS last night... Still working on it...
Title: Re: fatal error: 'TargetConditionals.h' not found when I test if SFML works
Post by: eXpl0it3r on April 30, 2021, 10:06:24 am
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.