Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 04.02.2011, 08:09   #1
Ирискин
 
Регистрация: 04.02.2011
Сообщений: 7
Сообщение Ошибка в коде С++

Код:
 #include <hge.h>
#include <hgefont.h>
#include <hgegui.h>

#include <menuitem.h>

#include <math.h>


// Pointer to the HGE interface.
// Helper classes require this to work.
HGE *hge=0;

// Some resource handles
HEFFECT				snd;
HTEXTURE			tex;
hgeQuad				quad;

// Pointers to the HGE objects we will use
hgeGUI				*gui;
hgeFont				*fnt;
hgeSprite			*spr;


bool FrameFunc()
{
	float dt=hge->Timer_GetDelta();
	static float t=0.0f;
	float tx,ty;
	int id;
	static int lastid=0;

	// If ESCAPE was pressed, tell the GUI to finish
	if(hge->Input_GetKeyState(HGEK_ESCAPE)) { lastid=5; gui->Leave(); }
	
	// We update the GUI and take an action if
	// one of the menu items was selected
	id=gui->Update(dt);
	if(id == -1)
	{
		switch(lastid)
		{
			case 1:
			case 2:
			case 3:
			case 4:
				gui->SetFocus(1);
				gui->Enter();
				break;

			case 5: return true;
		}
	}
	else if(id) { lastid=id; gui->Leave(); }

	// Here we update our background animation
	t+=dt;
	tx=50*cosf(t/60);
	ty=50*sinf(t/60);

	quad.v[0].tx=tx;        quad.v[0].ty=ty;
	quad.v[1].tx=tx+800/64; quad.v[1].ty=ty;
	quad.v[2].tx=tx+800/64; quad.v[2].ty=ty+600/64;
	quad.v[3].tx=tx;        quad.v[3].ty=ty+600/64;

	return false;
}

bool RenderFunc()
{
	// Render graphics
	hge->Gfx_BeginScene();
	hge->Gfx_RenderQuad(&quad);
	gui->Render();
	fnt->SetColor(0xFFFFFFFF);
	fnt->printf(5, 5, HGETEXT_LEFT, "dt:%.3f\nFPS:%d", hge->Timer_GetDelta(), hge->Timer_GetFPS());
	hge->Gfx_EndScene();

	return false;
}

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	hge = hgeCreate(HGE_VERSION);

	hge->System_SetState(HGE_FRAMEFUNC, FrameFunc);
	hge->System_SetState(HGE_RENDERFUNC, RenderFunc);
	hge->System_SetState(HGE_TITLE, "HGE Tutorial 06 - Creating menus");
	hge->System_SetState(HGE_WINDOWED, true);
	hge->System_SetState(HGE_SCREENWIDTH, 800);
	hge->System_SetState(HGE_SCREENHEIGHT, 600);
	hge->System_SetState(HGE_SCREENBPP, 32);

	if(hge->System_Initiate())
	{

		// Load sound and textures
		quad.tex=hge->Texture_Load("bg.png");
		tex=hge->Texture_Load("cursor.png");
		snd=hge->Effect_Load("menu.wav");
		if(!quad.tex || !tex || !snd)
		{
			// If one of the data files is not found, display
			// an error message and shutdown.
			MessageBox(NULL, "Can't load BG.PNG, CURSOR.PNG or MENU.WAV", "Error", MB_OK | MB_ICONERROR | MB_APPLMODAL);
			hge->System_Shutdown();
			hge->Release();
			return 0;
		}

		// Set up the quad we will use for background animation
		quad.blend=BLEND_ALPHABLEND | BLEND_COLORMUL | BLEND_NOZWRITE;

		for(int i=0;i<4;i++)
		{
			// Set up z-coordinate of vertices
			quad.v[i].z=0.5f;
			// Set up color. The format of DWORD col is 0xAARRGGBB
			quad.v[i].col=0xFFFFFFFF;
		}

		quad.v[0].x=0; quad.v[0].y=0; 
		quad.v[1].x=800; quad.v[1].y=0; 
		quad.v[2].x=800; quad.v[2].y=600; 
		quad.v[3].x=0; quad.v[3].y=600; 


		// Load the font, create the cursor sprite
		fnt=new hgeFont("font1.fnt");
		spr=new hgeSprite(tex,0,0,32,32);

		// Create and initialize the GUI
		gui=new hgeGUI();

		gui->AddCtrl(new hgeGUIMenuItem(1,fnt,snd,400,200,0.0f,"Play"));
		gui->AddCtrl(new hgeGUIMenuItem(2,fnt,snd,400,240,0.1f,"Options"));
		gui->AddCtrl(new hgeGUIMenuItem(3,fnt,snd,400,280,0.2f,"Instructions"));
		gui->AddCtrl(new hgeGUIMenuItem(4,fnt,snd,400,320,0.3f,"Credits"));
		gui->AddCtrl(new hgeGUIMenuItem(5,fnt,snd,400,360,0.4f,"Exit"));

		gui->SetNavMode(HGEGUI_UPDOWN | HGEGUI_CYCLED);
		gui->SetCursor(spr);
		gui->SetFocus(1);
		gui->Enter();

		// Let's rock now!
		hge->System_Start();

		// Delete created objects and free loaded resources
		delete gui;
		delete fnt;
		delete spr;
		hge->Effect_Free(snd);
		hge->Texture_Free(tex);
		hge->Texture_Free(quad.tex);
	}

	// Clean up and shutdown
	hge->System_Shutdown();
	hge->Release();
	return 0;
}
Помогите, пожалуйста, решить эту проблему
З.Ы. не нашел на форуме что-то типа спойлера, поэтому сообщение получилось страшное.
З.Ы.2 пришлось отправить комментарием ошибку
Ирискин вне форума Ответить с цитированием
Старый 04.02.2011, 08:09   #2
Ирискин
 
Регистрация: 04.02.2011
Сообщений: 7
По умолчанию

Ошибка:

1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::Enter(void)" (?Enter@hgeGUI@@QAEXXZ) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::SetFocus(int)" (?SetFocus@hgeGUI@@QAEXH@Z) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: int __thiscall hgeGUI::Update(float)" (?Update@hgeGUI@@QAEHM@Z) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::Leave(void)" (?Leave@hgeGUI@@QAEXXZ) referenced in function "bool __cdecl FrameFunc(void)" (?FrameFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __cdecl hgeFont::printf(float,float,int,cha r const *,...)" (?printf@hgeFont@@QAAXMMHPBDZZ) referenced in function "bool __cdecl RenderFunc(void)" (?RenderFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeFont::SetColor(unsigned long)" (?SetColor@hgeFont@@QAEXK@Z) referenced in function "bool __cdecl RenderFunc(void)" (?RenderFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::Render(void)" (?Render@hgeGUI@@QAEXXZ) referenced in function "bool __cdecl RenderFunc(void)" (?RenderFunc@@YA_NXZ)
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::SetCursor(class hgeSprite *)" (?SetCursor@hgeGUI@@QAEXPAVhgeSprit e@@@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::SetNavMode(int)" (?SetNavMode@hgeGUI@@QAEXH@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: void __thiscall hgeGUI::AddCtrl(class hgeGUIObject *)" (?AddCtrl@hgeGUI@@QAEXPAVhgeGUIObje ct@@@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeGUIMenuItem::hgeGUIMenuItem(int, class hgeFont *,unsigned long,float,float,float,char *)" (??0hgeGUIMenuItem@@QAE@HPAVhgeFont @@KMMMPAD@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeGUI::hgeGUI(void)" (??0hgeGUI@@QAE@XZ) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeSprite::hgeSprite(unsigned long,float,float,float,float)" (??0hgeSprite@@QAE@KMMMM@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeFont::hgeFont(char const *,bool)" (??0hgeFont@@QAE@PBD_N@Z) referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol _hgeCreate@4 referenced in function _WinMain@16
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeGUI::~hgeGUI(void)" (??1hgeGUI@@QAE@XZ) referenced in function "public: void * __thiscall hgeGUI::`scalar deleting destructor'(unsigned int)" (??_GhgeGUI@@QAEPAXI@Z)
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeFont::~hgeFont(void)" (??1hgeFont@@QAE@XZ) referenced in function "public: void * __thiscall hgeFont::`scalar deleting destructor'(unsigned int)" (??_GhgeFont@@QAEPAXI@Z)
1>menu.obj : error LNK2001: unresolved external symbol "protected: static class HGE * hgeSprite::hge" (?hge@hgeSprite@@1PAVHGE@@A)
Ирискин вне форума Ответить с цитированием
Старый 04.02.2011, 10:30   #3
p51x
Старожил
 
Регистрация: 15.02.2010
Сообщений: 15,715
По умолчанию

либы HGE не подключили
p51x вне форума Ответить с цитированием
Старый 04.02.2011, 15:13   #4
Ирискин
 
Регистрация: 04.02.2011
Сообщений: 7
По умолчанию

новая ошибка - не хватает libc.lib
где её можно скачать?
заметил, что много либ и .х не хватает в моем визуал с++, урезанная она какая-то

----с 2003 взял, уже не надо, спасибо

Последний раз редактировалось Ирискин; 04.02.2011 в 15:15.
Ирискин вне форума Ответить с цитированием
Старый 04.02.2011, 15:17   #5
Ирискин
 
Регистрация: 04.02.2011
Сообщений: 7
По умолчанию

1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>menu.obj : error LNK2019: unresolved external symbol "public: __thiscall hgeGUIMenuItem::hgeGUIMenuItem(int, class hgeFont *,unsigned long,float,float,float,char *)" (??0hgeGUIMenuItem@@QAE@HPAVhgeFont @@KMMMPAD@Z) referenced in function _WinMain@16
1>C:\Users\Администратор\Documents\ Visual Studio 2008\Projects\game\Debug\game.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Администратор\Documents\Vi sual Studio 2008\Projects\game\game\Debug\Build Log.htm"

ап! помогите )

up up up up -_-

Последний раз редактировалось Stilet; 08.02.2011 в 08:14.
Ирискин вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
Ошибка в коде xaero93 Помощь студентам 1 30.01.2011 15:08
ошибка в коде c# Roegis Помощь студентам 6 14.01.2011 13:00
Ошибка в коде, ошибка в css или это проблема с совместимостью с браузерами? ankris HTML и CSS 5 23.11.2010 16:58
Ошибка в коде с++ Айдар Помощь студентам 1 14.04.2010 23:15
Ошибка в коде hacknet Компоненты Delphi 12 07.12.2008 14:23