Same I have done , used "Command Line Tool template, selecting C++ as the language".
When I don't include random I get output "Hello I am 201703".
Mac OS - 13.3
Xcode - 14.3
I also selected C++ Language Dialect in build setting as "C++17".
Apparently this works when I run from command line. Following is my Makefile. But I need to debug code so I thought to build in xcode and getting error when I include random.
CXX = clang++
CXXFLAGS = -std=c++17
INCLUDES = -I/opt/homebrew/Cellar/boost/1.81.0_1/include
LIBS = -L/opt/homebrew/Cellar/boost/1.81.0_1/lib -lboost_graph
SRC = main.cpp
EXECUTABLE = main
all: $(EXECUTABLE)
$(EXECUTABLE): $(SRC)
@echo "Compiling ..."
@$(CXX) $(CXXFLAGS) $(INCLUDES) $< -o $@ $(LIBS) 2>&1 | tee compile.log
.PHONY: clean
clean:
@echo "Cleaning ....."
rm -f $(EXECUTABLE)
@echo "Cleanup Complete. "
run:
@echo "Running ....."
@./$(EXECUTABLE) 2>&1 | tee run.log
@echo "Execution Complete. "
play:
@echo "Displaying graph"
@open erdos_renyi.png
build: clean main run