Создание перенасыщения с Makefile в ma c OSX - PullRequest
0 голосов
/ 21 марта 2020

полностью Makefile newb ie здесь. Профессор попросил меня представить Makefile вместе с реальным исходным кодом. Мне трудно найти компоновщик для поиска файлов Glut. Моя заявка имеет следующую структуру

app structure

Моя основная. cpp имеет следующие зависимости:

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "renderer.cpp"

Мой рендерер. cpp имеет следующие зависимости:

#define GL_SILENCE_DEPRECATION
#ifdef __APPLE__
#include <GLUT/glut.h>
#else
#include <GL/glut.h>
#endif

#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <vector>
#include "reader.cpp"
#include "../../../Common/Point.h"

Мой читатель. cpp имеет следующие зависимости:

#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include "../headers/reader.h"
#include "../../../Common/Point.h"

И, наконец, моя точка. cpp имеет следующие зависимости:

#include <iostream>
#include <sstream>
#include "Point.h"

У меня нулевой опыт работы с Makefile, и все, что я знаю, было взято из видео на YouTube, которое я смотрю, чтобы иметь представление о том, что делать. Makefile выглядит следующим образом:

engine: main.o renderer.o reader.o Point.o
        g++ main.o renderer.o reader.o Point.o -o engine

main.o: main.cpp
        g++ -c main.cpp $ ./renderer.cpp $(-framework GLUT -framework OpenGL -framework      Cocoa)

renderer.o: renderer.cpp
            g++ -c renderer.cpp $(-framework GLUT -framework OpenGL -framework Cocoa) $   ./reader.cpp $ ../../../Common/Point.h

reader.o: reader.cpp
      g++ -c reader.cpp $ ../headers/reader.h $ ../../../Common/Point.h

Point.o: ../../../Common/Point.cpp
     g++ -c ../../../Common/Point.cpp $ ../../../Common/Point.h

clean:
    rm *.o
    rm *.xml
    rm *.3d

Когда я пытаюсь запустить make, я получаю сообщение об ошибке «Неопределенные символы для архитектуры x86_64:», за которым следует каждая вызываемая мной функция glut / Opengl. Я знаю, что make-файл написан плохо, но я очень признателен за помощь.

...