a series of debugging
.
├── Makefile
├── fonts
│ └── ...
├── imgs
│ └── ...
├── maps
│ ├── ...
├── src
│ ├── constants.hpp
│ ├── game_utils.cpp
│ ├── game_utils.hpp
│ ├── main.cpp
│ ├── utils.cpp
│ ├── utils.hpp
│ ├── controllers
│ │ ├── ...
│ ├── views
│ │ ├── ...
│ ├── helpers
│ │ ├── ...
│ ├── models
│ │ ├── ...
...
brew install sdl2
brew install sdl2_image
brew install sdl2_ttf
brew install sdl2_gfx
make
POSIX-compatible programming and runtime environment
directory layout that is similar to Unix-like systems
package system
No SDL2_gfx
Add the missing header files my solve the problem
Where should I put?
// add.cpp
int add(int a, int b) {
int result = a + b;
return result;
#include "endBrace.h"
// endBrace.h
}
g++ -E -c add.cpp
// main.cpp
void Log(const char* message);
int main() {
Log("hello world");
}
// log.cpp
#include <iostream>
void Logg(const char* message) {
std::cout << message << std::endl;
}
#ifndef SDL_shape_h_
#define SDL_shape_h_
#include "SDL_stdinc.h" C++ */
#ifdef __cplusplus
extern "C" {
#endif
#define SDL_NONSHAPEABLE_WINDOW -1
#define SDL_INVALID_SHAPE_ARGUMENT -2
#define SDL_WINDOW_LACKS_SHAPE -3
extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(
const char *title,unsigned int x,unsigned int y,unsigned int w,
unsigned int h,Uint32 flags);
...
header files are not enough, so related lib should be linked
-L<directory>
-lSDL2
find libSDL2
Seem to work???
dll -> dynamic linking library
Then I use MinGW.
Pros
Cons
need import library
Pros
Cons
The directory of the executable
The current directory
The Windows system directory
The Windows directory
The directories listed in the PATH environment variable
But my code is
MinGW\bin\g++ .\src\utils.cpp -c -o bin\utils.o
.
├── Makefile
├── bin
│ └── main.exe
├── src
│ └── ...
├── MinGW
│ ├── bin
│ │ ├── g++.exe
│ │ ├── SDL2.dll
│ │ ├── ...
│ ├── lib
│ │ ├── libSDL2.a
│ │ ├── ...
│ ├── include
│ │ ├── SDL2
│ │ ├── SDL2_rotozoom
...
compile & assemble
Preprocess
libraries
(.lib)
.dll
include
lib
bin