我成功编辑了visual studio 2013(msvc 12)中的allegro 4.4
我尝试编译atanks 6.4开源项目
在项目内部,我链接到已经在allegro项目中编译的alleg.lib
当我编译atanks时,它会抛出错误消息:
这个错误没有链接allegro。但我做链接,它找到了lib文件。
1>atanks.obj : error LNK2001: unresolved external symbol __imp__mouse_x
1>atanks.obj : error LNK2001: unresolved external symbol __imp__reserve_voices
1>atanks.obj : error LNK2001: unresolved external symbol __imp___WinMain
1>atanks.obj : error LNK2001: unresolved external symbol __imp__install_keyboard
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_color_depth
1>atanks.obj : error LNK2001: unresolved external symbol __imp__get_mixer_voices
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_mouse_sprite
1>atanks.obj : error LNK2001: unresolved external symbol __imp__mouse_y
1>atanks.obj : error LNK2001: unresolved external symbol __imp__detect_digi_driver
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_mouse_sprite_focus
1>atanks.obj : error LNK2001: unresolved external symbol __imp__readkey
1>atanks.obj : error LNK2001: unresolved external symbol __imp__makecol
1>atanks.obj : error LNK2001: unresolved external symbol __imp__text_length
1>atanks.obj : error LNK2001: unresolved external symbol __imp__show_os_cursor
1>atanks.obj : error LNK2001: unresolved external symbol __imp__get_config_string
1>atanks.obj : error LNK2001: unresolved external symbol __imp__clear_keybuf
1>atanks.obj : error LNK2001: unresolved external symbol __imp__textout_ex
1>atanks.obj : error LNK2001: unresolved external symbol __imp__blit
1>atanks.obj : error LNK2001: unresolved external symbol __imp__textprintf_right_ex
1>atanks.obj : error LNK2001: unresolved external symbol __imp__textout_centre_ex
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_close_button_callback
1>atanks.obj : error LNK2001: unresolved external symbol __imp__font
1>atanks.obj : error LNK2001: unresolved external symbol __imp__install_mouse
1>atanks.obj : error LNK2001: unresolved external symbol __imp__keypressed
1>atanks.obj : error LNK2001: unresolved external symbol __imp__textprintf_centre_ex
1>atanks.obj : error LNK2001: unresolved external symbol __imp__enable_triple_buffer
1>atanks.obj : error LNK2001: unresolved external symbol __imp__screen
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_display_switch_mode
1>atanks.obj : error LNK2001: unresolved external symbol __imp__get_mixer_quality
1>atanks.obj : error LNK2001: unresolved external symbol __imp__remove_sound
1>atanks.obj : error LNK2001: unresolved external symbol __imp__mouse_b
1>atanks.obj : error LNK2001: unresolved external symbol __imp__stop_sample
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_mixer_quality
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_config_string
1>atanks.obj : error LNK2001: unresolved external symbol __imp___install_allegro_version_check
1>atanks.obj : error LNK2001: unresolved external symbol __imp__install_sound
1>atanks.obj : error LNK2001: unresolved external symbol __imp__unscare_mouse
1>atanks.obj : error LNK2001: unresolved external symbol __imp__allegro_exit
1>atanks.obj : error LNK2001: unresolved external symbol __imp__show_mouse
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_gfx_mode
1>atanks.obj : error LNK2001: unresolved external symbol __imp__scare_mouse
1>atanks.obj : error LNK2001: unresolved external symbol __imp__draw_sprite
1>atanks.obj : error LNK2001: unresolved external symbol __imp__rect
1>atanks.obj : error LNK2001: unresolved external symbol __imp__rectfill
1>atanks.obj : error LNK2001: unresolved external symbol __imp__clear_to_color
1>atanks.obj : error LNK2001: unresolved external symbol __imp__get_desktop_resolution
1>atanks.obj : error LNK2001: unresolved external symbol __imp__desktop_color_depth
1>atanks.obj : error LNK2001: unresolved external symbol __imp__set_window_title
1>beam.obj : error LNK2001: unresolved external symbol __imp__set_trans_blender
1>beam.obj : error LNK2001: unresolved external symbol __imp__drawing_mode
1>beam.obj : error LNK2001: unresolved external symbol __imp__do_line
1>beam.obj : error LNK2001: unresolved external symbol __imp__circlefill
1>beam.obj : error LNK2001: unresolved external symbol __imp__getpixel
1>button.obj : error LNK2001: unresolved external symbol __imp__text_height
1>button.obj : error LNK2001: unresolved external symbol __imp__line
1>clock.obj : error LNK2001: unresolved external symbol __imp__install_int_ex
1>clock.obj : error LNK2001: unresolved external symbol __imp__remove_int
1>debris_pool.obj : error LNK2001: unresolved external symbol __imp__create_bitmap
1>debris_pool.obj : error LNK2001: unresolved external symbol __imp__destroy_bitmap
1>decor.obj : error LNK2001: unresolved external symbol __imp__getb
1>decor.obj : error LNK2001: unresolved external symbol __imp__getr
1>decor.obj : error LNK2001: unresolved external symbol __imp__getg
1>decor.obj : error LNK2001: unresolved external symbol __imp__itofix
1>decor.obj : error LNK2001: unresolved external symbol __imp__rotate_sprite
1>decor.obj : error LNK2001: unresolved external symbol __imp__putpixel
1>environment.obj : error LNK2001: unresolved external symbol __imp__load_font
1>environment.obj : error LNK2001: unresolved external symbol __imp__allegro_error
1>environment.obj : error LNK2001: unresolved external symbol __imp__destroy_font
1>environment.obj : error LNK2001: unresolved external symbol __imp__destroy_sample
1>environment.obj : error LNK2001: unresolved external symbol __imp__load_sample
1>environment.obj : error LNK2001: unresolved external symbol __imp__load_bitmap
1>explosion.obj : error LNK2001: unresolved external symbol __imp__masked_blit
1>explosion.obj : error LNK2001: unresolved external symbol __imp__allegro_errno
1>explosion.obj : error LNK2001: unresolved external symbol __imp__ftofix
1>explosion.obj : error LNK2001: unresolved external symbol __imp__rotate_scaled_sprite
1>explosion.obj : error LNK2001: unresolved external symbol __imp__ellipsefill
1>explosion.obj : error LNK2001: unresolved external symbol __imp__circle
1>explosion.obj : error LNK2001: unresolved external symbol __imp__triangle
1>files.obj : error LNK2001: unresolved external symbol __imp__set_clip_rect
1>floattext.obj : error LNK2001: unresolved external symbol __imp__hsv_to_rgb
1>floattext.obj : error LNK2001: unresolved external symbol __imp__rgb_to_hsv
1>gameloop.obj : error LNK2001: unresolved external symbol __imp__textprintf_ex
1>gameloop.obj : error LNK2001: unresolved external symbol __imp__textout_right_ex
1>gameloop.obj : error LNK2001: unresolved external symbol __imp___allegro_hline
1>globaldata.obj : error LNK2001: unresolved external symbol __imp___allegro_vline
1>globaldata.obj : error LNK2001: unresolved external symbol __imp__release_bitmap
1>globaldata.obj : error LNK2001: unresolved external symbol __imp__acquire_bitmap
1>land.obj : error LNK2001: unresolved external symbol __imp__solid_mode
1>menu.obj : error LNK2001: unresolved external symbol __imp__key
1>optionitembase.obj : error LNK2001: unresolved external symbol __imp__draw_sprite_v_flip
1>optionitembase.obj : error LNK2001: unresolved external symbol __imp__ellipse
1>player.obj : error LNK2001: unresolved external symbol __imp__save_bmp
1>player.obj : error LNK2001: unresolved external symbol __imp__key_shifts
1>shop.obj : error LNK2001: unresolved external symbol __imp__stretch_blit
1>shop.obj : error LNK2001: unresolved external symbol __imp__mouse_z
1>sky.obj : error LNK2001: unresolved external symbol __imp__set_add_blender
1>sound.obj : error LNK2001: unresolved external symbol __imp__play_sample
我该怎么办? 这有什么问题?
答案 0 :(得分:0)
我看一下沿着allegro lib编译的另一个项目。 (使用alleg.lib)。
我添加到atanks项目预备这一行:
_CRT_SECURE_NO_DEPRECATE
_CRT_NONSTDC_NO_DEPRECATE
ALLEGRO_STATICLINK
CMAKE_INTDIR="RelWithDebInfo"
添加更多必要的lib文件,然后成功编译并运行。