PDA

View Full Version : error when i try to compile it ...?



squall
09-16-2004, 09:17 AM
hi all
i get this error


Linking...
main.obj : error LNK2001: unresolved external symbol "public: __thiscall aShaderManager::aShaderManager(void)" (??0aShaderManager@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall aShaderManager::~aShaderManager(void)" (??1aShaderManager@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: class aShaderObject * __thiscall aShaderManager::loadfromMemory(char const *,char const *)" (?loadfromMemory@aShaderManager@@QAEPAVaShaderObje ct@@PBD0@Z)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall aShaderObject::end(void)" (?end@aShaderObject@@QAEXXZ)
main.obj : error LNK2001: unresolved external symbol "public: void __thiscall aShaderObject::begin(void)" (?begin@aShaderObject@@QAEXXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/main.exe : fatal error LNK1120: 6 unresolved externals
Error executing link.exe.

main.exe - 7 error(s), 0 warning(s)when i try to compile this code


// ************************************************** **
// Simple program to test GLSL Shaders
//
// This Program shows how to load a Shader from memory
//
// Implement the functions:
// AppInit() to initialize
// AppExit() to clean up
// and DrawFrame() to draw one frame
// ************************************************** **
#include <windows.h>
#include "../cwc/aGLSL.h"
#include <GL/glut.h>
#include <GL/gl.h>

aShaderManager shadermanager;
aShaderObject* shader;

static const char* myVertexShader =
"void main(void) \n"
"{ \n"
" vec4 a = vec4(1.0,0.5,1.0,1.0) * gl_Vertex; \n"
" gl_Position = gl_ModelViewProjectionMatrix * a; \n"
"} \n\0";

static const char* myFragmentShader =
"void main (void) \n"
"{ \n"
" gl_FragColor = vec4 (0.0, 1.0, 0.0, 1.0); \n"
"} \n\0";

//************************************************** ***********
// at the time of App init, glut is already initialized
// and standard OpenGL settings are done. You could test
// extensions etc now!

void AppInit(void)
{
shader = shadermanager.loadfromMemory(myVertexShader,myFrag mentShader);

if (shader==0)
{
std::cout << "error: can't init shader!\n";
exit(-1);
}

//shader = shadermanager.loadfromFile("test.vert","test.frag");
}

//************************************************** ***********
//Draw one Frame (don't Swap Buffers)
void DrawFrame(void)
{
shader->begin();
glutSolidTeapot(1.5);
shader->end();
}


//************************************************** ***********
// use App Exit to clean up
void AppExit(void)
{

}

//************************************************** ***********thank you all for any reply
"i hope this is the right forum for this topic :D "

EDIT :OPS i didn't notic that :eek:

ZbuffeR
09-16-2004, 01:03 PM
It seems to be the right forum, but edit your post so that line breaks are present ... no really readable right now.
Edit : thanks, it is better now.

RigidBody
09-16-2004, 11:30 PM
seems like the types aShaderManager and aShaderObject are unknown to the compiler. are they defined in "../cwc/aGLSL.h"? is the path correct?

second problem, your program doesn't look like a windows prog. windows progs need a winmain function:

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

and you have to tell your compiler that you want to create a windows (not a dos) application. if you are using borland just use the "-tW" flag

bcc32 -tW test.cpp

squall
09-17-2004, 12:49 AM
aShaderManager and aShaderObject are defined in aGLSL.h mmmmm i do what you say but :( nothing

is there good tutorials for GLSL "Beginners" with samples :)

robosport
09-18-2004, 12:09 AM
Does your project include (are you compiling) the c or cpp file that contains the implementation of the aShaderManager class?

There error looks like the implementation for those functions is the missing link. Hey thats punny... :)

squall
09-19-2004, 04:22 AM
mmmm ok i want know where i can find GLSL files "*.lib *.dll *.h"
please i need it :)

squall
09-20-2004, 10:26 AM
UP ... :rolleyes: