1
General / Compiling / Linking a simple project on macOS with command line tools
« on: March 28, 2020, 05:38:38 pm »
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
- vi header.h
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!)
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;
}
#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#include "/usr/local/SFML/include/SFML"
#include "/usr/local/SFML/include/SFML/Graphics.hpp"
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!)