c++ - Compiling SDL on OS X with makefile -


I am trying to compile the Tetris program written with C ++ and SDL on OS X. First I tried to do this:

  `G ++ -O Tetris Main. Cpp` SDL-config - seaflag - lbs '-framework cocoa'  
< P> And found it:

  Undefined symbols: "Game :: startGame ()", referenced from: _main ccQMhbGx.o "Game :: Games ()", referenced from: _main in ccQMhbGx .o ld: Symbol (s) not found Collection 2: LD has returned 1 exit status  

Here is the main CPP file:

  # Include & lt; Iostream & gt; #include "game.h" int main (int argc, char * argv []) {game * game = new game (); Sports-> StartGame (); Return 0; }  

Game.h is a sports class where all other classes (board .h, IOH, Peace H, Piece H) are included and the main logic of the game Is contained.

I would really like to be able to write a makefile for this or in some way to distribute friends easily.

Edit:

If someone is having the same problem, then here is the last mess file:

  cc = g ++ CFLAGS = -C -Wall SDLFLAGS = 'SDL-config - -flags -libs` -framework coco source = main.cpp Game.cpp IO.cpp board.cpp pieces CPP grinding CPP objects = $ (source: CPP = .o) Exxable = Tetris all: $ (source) $ (executed) $ (executed): $ (objects) $ (cc) $ (objects) $ (SDLFALGS) -a $ @ CPOO: $ (CC) $ (CFLAGS) $ & lt; -O $ @ clean: rm-rf * .o $ (executable)  

< Strike> I think your compilation issue is related to SDL main work

Compilation failure because you are missing references to "Game.o" or compiling Game.cpp Try the generated object file as whatever:

  G ++ -O Tetris main CPP game. O Piece.O whaverlace.O SDL-config - C flag S - Elbis` -fremvrk cocoa  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -