OpenGL Red Book example 1-1 error LNK2019; Problems with GLUT and GLEW, as well as many default libs

StackOverflow https://stackoverflow.com/questions/21396516

  •  03-10-2022
  •  | 
  •  

Question

I got the Red book to expand my currently small knowledge on OpenGL, but the first tutorial is giving me nightmarish problems. You've seen a few of these, I know, but I've got LoadShaders.cpp pointed to and /NODEFAULTLIB set to yes in the project settings, and it has all come down to this last bunch of errors, all or most LNK2019's.

http://pastebin.com/2tTUtiUc Is where you can see the errors. I don't know if I should paste the code here, as you may have already seen it.

One more thing, I tried what the other posters said resolved it for them, but it doesn't resolve it for me.

Was it helpful?

Solution 2

OK, this is wierd to me, but pointing the linker to glew32.lib and freeglut.lib and disabling libcmtd.lib seemed to fix the problem. After that, I can build it with no problem. So, just to repeat, Additional dependencies is set to only glew32.lib and freeglut.lib, and ignore default libraries is set to no, and ignore libcmtd.lib.

OTHER TIPS

You should post less complain and more details, so others can do more to help. LNK2019 usually means you are having problem with the linking phase. problems might be:

  1. did you put the .lib file under link path? can linkers find them?
  2. linking parameter details , could it be related with:

    one of the third-party libraries was not set to /MT in release (but it was /MTd in debug) - changing that flag made it all work.

lastly, working directly from working examples instead of set them up all yourselves.

start from Working Excample, get code directly there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top