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

Author Topic: Compiling / Linking a simple project on macOS with command line tools  (Read 881 times)

0 Members and 1 Guest are viewing this topic.

ryanmaneo

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
I am trying to figure out how I can create a very simple project with SFML and command line tools/Clang compiler using command line tools.

I have yet to find decent documentation on how to do this step by step, the closest being the Linux tutorial. But unfortunately it doesn't seem to work.
Here's what I'm doing EXACTLY.

- Installed SFML to /usr/local
- mkdir HelloWorld
- cd HelloWorld
- touch HelloWorld.cpp
- touch header.h
- vi HelloWorld.cpp

#include <iostream>
#include "header.h"

int main() {
 std::cout << "Hello World" << std::endl;
return 0;
}

- vi header.h

#pragma once
#include "/usr/local/SFML/include/SFML"
#include "/usr/local/SFML/include/SFML/Graphics.hpp"
 
- g++ -c main.cpp

from here, it usually says that Graphics.hpp cannot be found. I have tried several things including using -framework, -I, etc. (It is entirely possible that I am misusing these though, because I have yet to find instruction on how to implement these tools into my command line to compile my code).

If anyone knows of a step by step guide to implementing / linking SFML with macOS command line tools, I would appreciate it. (Or if you know how to explain it yourself even better!)

 

anything