0
运行快板我跑了BREW在OSX错误的OSX
安装快板下面这个教程:https://wiki.allegro.cc/index.php?title=Example_ExHello
我的代码
include <allegro.h>
int main(void) {
if (allegro_init() != 0)
return 1;
/* set up the keyboard handler */
install_keyboard();
/* set a graphics mode sized 320x200 */
if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
return 1;
}
}
/* set the color palette */
set_palette(desktop_palette);
/* clear the screen to white */
clear_to_color(screen, makecol(255, 255, 255));
/* you don't need to do this, but on some platforms (eg. Windows) things
* will be drawn more quickly if you always acquire the screen before
* trying to draw onto it.
*/
acquire_screen();
/* write some text to the screen with black letters and transparent background */
textout_centre_ex(screen, font, "Hello, world!", SCREEN_W/2, SCREEN_H/2, makecol(0,0,0), -1);
/* you must always release bitmaps before calling any input functions */
release_screen();
/* wait for a keypress */
readkey();
return 0;
}
1.c:1:1: error: unknown type name 'include'
include <allegro.h>
^
1.c:1:9: error: expected identifier or '('
include <allegro.h>
^
2 errors generated.
make: *** [1] Error 1
我被误以为印象是一个纯粹的C库。谢谢,这会画出一个黑色的矩形窗口。 – quantumpotato
我对C VS C++问题的理由是,当我编译C编译器这个例子中,'al_map_rgb更换'al_map_rgb(0,0,0)'(255,255,255)'程序将与SEGV,这是崩溃通过使用C++编译器来避免某种形式的二进制兼容性问题或其中*似乎*编译器的问题。 – Petesh