0

So I downloaded this rar from the opengl red book:http://www.opengl-redbook.com/Code/oglpg-8th-edition.zip

And what I do is this:

  1. Open a new empty Project
  2. Browse to the project properties -> Configuration Properties -> VC++ Directories
  3. Add the lib and include folders from the downloaded Winrar.

That's all I do and when I run the project I get a lot of error's :\

What did I do wrong and what should I do to make it work for me?

EDIT: those are the errors i get:

Warning 7   warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library   C:\Users\Naor\documents\visual studio 2012\Projects\RedBook\RedBook\LINK    RedBook
Warning 1   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  25  1   RedBook
Warning 2   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  26  1   RedBook
Warning 3   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  27  1   RedBook
Warning 4   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  28  1   RedBook
Warning 5   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  29  1   RedBook
Warning 6   warning C4305: 'initializing' : truncation from 'double' to 'GLfloat'   c:\users\naor\documents\visual studio 2012\projects\redbook\redbook\source.cpp  30  1   RedBook
Error   8   error LNK2019: unresolved external symbol _LoadShaders referenced in function "void __cdecl init(void)" (?init@@YAXXZ)  C:\Users\Naor\documents\visual studio 2012\Projects\RedBook\RedBook\Source.obj  RedBook
Error   9   error LNK1120: 1 unresolved externals   C:\Users\Naor\documents\visual studio 2012\Projects\RedBook\Debug\RedBook.exe   1   1   RedBook

And that's the code:http://pastebin.com/X55tVP3d

Naor Hadar
  • 537
  • 1
  • 6
  • 19

1 Answers1

2
  1. warning LNK4098 => The first warning indicates that your project is using a C runtime different than the one used by your dependencies (typically static vs dynamic, release vs debug). This is controlled by the settings Code Generation > Runtime Library
    Details can be found here: Resolving LNK4098: defaultlib 'MSVCRT' conflicts with

  2. error LNK2019 => The linker could not find the definition of LoadShaders used in the function init(void). Either you forgot to add a cpp file containing the definition of LoadShaders, or you forgot to add a lib in your project.

Community
  • 1
  • 1
lolando
  • 1,721
  • 1
  • 18
  • 22
  • What can I do to fix the warning? I added the cpp and these are the error's:http://pastebin.com/Y1WxZ58W – Naor Hadar Oct 23 '13 at 15:57
  • I updated the answer. In your case, I think your project uses the static debug version, whereas your dependencies use the dynamic debug version. Could you check the setting of your project? Is it /MTd? – lolando Oct 23 '13 at 16:18
  • I dont have /MTd as an option. My settings are on /MDd – Naor Hadar Oct 23 '13 at 16:20
  • 1
    Ok, then using /MTd in your settings should fix the C run time consistency. Could you kindly confirm? – lolando Oct 23 '13 at 16:25
  • Nope, it didn't work :\ What should i do about the cpp file? i keep getting the error's i posted above – Naor Hadar Oct 23 '13 at 16:28
  • 1
    I see. I checked the package you mentionned in the question, and i think the LNK4098 warning is due to dependencies not related to oglpg. I am afraid you have to check the run time used by your dlls – lolando Oct 23 '13 at 16:54
  • I am new to this do you have any idea how do i do this? :\ – Naor Hadar Oct 23 '13 at 16:56