Hey all I have this program that is supposed to output a stickfigure.

I got this from my game programming elective class (which I now regret enrolling to) and the professor told us to work on it in a way that the class called "example" with the function render should call the stickfigure class's own rendering function to draw the stick figure. The example class's render function in turn is then called by my main function for display.

Sooo, the code he gave was on a powerpoint presentation. And I basically copy and pasted the code to what I think were their respective .cpp and .h places.

I compiled the code and displayed a window with just a black background. I tried tinkering with it too errr fix it, and now the code gives me 19 lnk2019 errors, with the complementary lnk1120 error.

I am very much clueless of what to do now (and what I have been doing while I was tinkering with it).

I desperately need help in understanding this.

Attached are the source files I have been using, along with the powerpoint presentation if that is of any help.
EDIT: oh wait, I'm not allowed to attach powerpoint files, so I converted it to a .pdf instead.

Thank you so much to those who'll be helping me. Understanding this will lead me one step closer to making our final project.

PS.

Aside from rendering the figure, there is a part in the code where it can animate the stick figure. Although I think he did not require us to animate the figure I still took a wild guess on calling the function for that in the prepare method of the example class, so sorry for that.

Thanks again!

Edited 6 Years Ago by ticktock: n/a

If you aren't using the animate function right now comment it out or make the function and just don't have anything in it (currently you have the prototype but no real definition and that is what is giving the error). Also when I read through your code your stick man is being drawn behind the camera so change stickFig1.render(1.0f, 1.0f, 1.0f); into stickFig1.render(0.0f, 0.0f, -30.0f); Also I was getting a whole bunch of warning but I'm not gonna go about messing with it since it works right now.

Edit: Both of the functions are in the example.cpp file and the line stickFig1.animate(dt); in the function prepare(float) should be commented out. In the function render() stickFig1.render(float, float, float) should be changed as stated above.

Edited 6 Years Ago by sfuo: n/a

hey sfuo! thanks for the reply! sorry if I replied just now. I tried your solution but I still got the errors. I am gonna try later what happens if I make a new solution with your fixes included. Will post later. Just got home from school. Thank you very much sfuo!

Ok, just tried it and I got various lnk2019 errors on the example.obj file, StickFigure.obj file and surprisingly in the glwindow.obj file.

What I did was File>New Project>From Existing Code>Followed the wizard>commented and edited the items that needed it>built and ran the solution.

I precisely done what you suggested which was comment the animate line in my prepare method, change the arguments for my render method and I also commented the function prototype of the animate method in my example.h

The linker errors that I got were related to Example::render, Example::onResize, GLWindow::WndProc, StickFigure::initialize, StickFigure::render, StickFigure::renderHead, StickFigure::renderCube.

All of these functions have their proper definitions and the respective header files that they prototypes belonged to were properly included on the .cpp files that needed them yet still lnk2019 errors :(

Edited 6 Years Ago by ticktock: n/a

I'm not 100% sure why its not working for you and I can't figure out how to fix any of the errors in Example::render onResize WndProc and all that if I don't actually know the error message, unless you are saying that they are all getting linker errors.

I was getting warning when compiling so I changed your GLWindow() function so it sets the variables within the brackets rather than in the unique way you had before.

Also you were using CreateWindowEx() and passing NULL for the extended styles when you can just use CreateWindow() because that parameter just doesn't exist in the function.

I've attached the source code from what you posted with the changes I made. I also included the project file (code blocks) that if you do use the same compiler then you can take a look at that and compare to see if you have something different.

They were lnk2019 errors, all of them.

But you know, sometimes if I work on a solution on codeblocks and visual studio c++ they compile differently in a way that there are more errors on visual studio than that of codeblocks.

Maybe it is something about visual c++?

I could have just tried making the solution in codeblocks earlier and tried it out myself, I do not know why I didn't consider it earlier though haha.

About the glWindow() function and its respective class, I just used that class and function as my professor supplied that code and class for us, I and my classmates had no troubles compiling that class before in previous projects and it perplexes me why it chose to act weird now.

Thank you for the code project file :D I'll just include a glulookat function later to change the camera angle. :D

This question has already been answered. Start a new discussion instead.