user3672700
user3672700

Reputation: 162

How can I rebuild an old library to work on a recent Visual Studio?

I've been trying to learn Directx recently and started to read "Introduction to 3D Game Programming With DirectX 11" by Frank Luna.

The book was being pretty interesting until I've encountered problems that I couldn't solve by my own. One of the first steps of the book is to compile one program that Frank Luna wrote, which is a Box drawn in DirectX, since the code he wrote in the book uses the Microsoft DirectX SDK(June 2010) I had to install it too, because apparently DirectX is now included in the Windows Kits which Windows 8 uses and, no longer supports D3DX(which is used in the book).

The error that I encountered was this one:

Error   2   error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1800' in Camera.obj

I found the answer by Luna himself (I think) here, but I don't know how to do that.

Luna says: You need to rebuild the Effects11 library with VS12. This forum post has more details:

viewtopic.php?f=4&t=295

Dreamcore asks: How do I rebuild it? The post only said that I must rebuild it but now HOW TO rebuild it.

Luna answers: In the June 2010 SDK there is the Effects11 project:

E:\DXSDKJune10\Samples\C++\Effects11

Open the solution and build in debug mode (naming the output Effects11d.lib) and in release mode (naming the output Effects11.lib). Then copy these two .lib to the book's common directory.

Can someone tell me how do I build in debug and release mode and getting an output using visual studio 2013 professional? Effects11_2010.sln doesn't even compile neither in debug or release. It says unable to start the program.

Thanks

Upvotes: 2

Views: 1958

Answers (1)

Holosim
Holosim

Reputation: 21

You found the answer, you're just missing one step. Ignore the message saying that VS can't start the program. You're building a binary library, not an executable. That's why it can't start the program, because you didn't build one.

The newly compiled Effects11.lib file will be in the DEBUG folder. Just rename it to add the 'd' at the end of the filename and save it to the COMMON folder in the LUNA sample files. You should probably rename the original file in the COMMON folder first so that you can recover it, unless you have the original ZIP from the book disk. Then recompile and the box example will work. This is assuming that you've already used the VS2013 wizard to convert the solution's Platform Toolset from v100 (VS2010) to v120 (VS2012/VS2013).

Also, don't forget to comment out the entire contents of the HR macro in the Luna's D3DUtil.h file. I don't know if it EVER worked, but it hasn't worked since DirectX9c in VS2010, and still doesn't work now using DirectX11 in VS2013. Just find the HR definition and replace it with this:

#define HR(x){HRESULT hr = (x);}                                
    /*if(FAILED(hr))                                         
    {                                                      
        //DXTrace(__FILE__, (DWORD)__LINE__, hr, L#x, true); 
    }                                                      
}*/

Upvotes: 2

Related Questions