I make a simple project to test cross-compile Windows app on Mac.
This is the main.c
#include “SDL.h”
#include “SDL_ttf.h”
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_GLYPH_H
#include FT_STROKER_H
const int WINDOW_WIDTH = 640;
const int WINDOW_HEIGHT = 480;
const char* WINDOW_TITLE = “SDL Start”;
int main(int argc, char *argv[])
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,
SDL_HWSURFACE | SDL_DOUBLEBUF );
TTF_Font *font = TTF_OpenFont("test.ttf", 18);
// FT_Library library;
// FT_Face face;
// const char * fname = “somefont”;
//
//
// if (FT_Init_FreeType( &library ))
// printf(“error init freetype”);
//
// if (FT_New_Face( library, fname, 0, &face ))
// printf(“error new face”);
//
// if(FT_Load_Glyph( face, FT_Get_Char_Index( face, ‘A’ ),
FT_LOAD_DEFAULT ))
// printf(“error load glyph”);
//
// FT_Glyph bitmap_glyph = NULL;
//
// FT_Stroker stroker;
// FT_Get_Glyph( face->glyph, &bitmap_glyph );
// int error = FT_Stroker_New( library, &stroker );
SDL_Event event;
printf("hello world.");
int gameRunning = 1;
while (gameRunning)
{
if (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
{
gameRunning = 0;
}
}
}
SDL_Quit();
return 0;
}
The link command:
/Developer/Cocotron/1.0/Windows/i386/gcc-4.3.1/bin/i386-mingw32msvc-gcc
-arch i386
-L/Users/shinno/Library/Developer/Xcode/DerivedData/SDL-hbbipiabkoxqhscyceucbktuavaw/Build/Products/Development_using_10.4SDK_and_10.6SDK
-filelist
"/Users/shinno/Library/Developer/Xcode/DerivedData/SDL-hbbipiabkoxqhscyceucbktuavaw/Build/Intermediates/SDL.build/Development_using_10.4SDK_and_10.6SDK/test-win32.build/Objects-normal/i386/test-win32.LinkFileList"
/Users/shinno/Library/Developer/Xcode/DerivedData/xign-ectoyemcfihayfhkbfsnwdgjwatz/Build/Products/Debug/libFreetype2-Win32.a
/Users/shinno/Library/Developer/Xcode/DerivedData/SDL-hbbipiabkoxqhscyceucbktuavaw/Build/Products/Release/libSDL_ttf-Win32.a
-lSDL-Win32 -lopengl32 -luuid -loleaut32 -lole32 -lgdi32 -lwinmm -lversion
-limm32 -o
/Users/shinno/Library/Developer/Xcode/DerivedData/SDL-hbbipiabkoxqhscyceucbktuavaw/Build/Products/Development_using_10.4SDK_and_10.6SDK/test-win32.exe
in brief
/i386-mingw32msvc-gcc -arch i386 [Filelist] -lSDL_ttf-Win32 -lSDL-Win32
-lFreetype2-Win32 out.exe
Now the problem:
When I comment the Freetype functions out like above, The SDL_ttf.c throw
"Undefined *FT_Get_Glyph" *error. When I remove the comment symbol, every
thing is ok.
The same thing also happen when I use SDL_image and libpng.
Can someone help?–
Best Regards
Xing Ye