Project

General

Profile

Unresolved external symbol error when compiling WT apps in Visual Studio

Added by John Davidson about 12 years ago

I'm attempting to configure WT for Visual Studio 11. I can make it work perfectly when I compile WT apps inside the default WT solution that gets built by CMake, but when I try to create a new solution and use WT from inside the new solution, I get numerous linker errors like this one:

1>Main.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Wt::WObject::setRequestTooLarge(__int64)" (?setRequestTooLarge`WObject@Wt@@MAEX_J`Z)

What I have done is this:

1) Installed Boost 1_53_0, checked it was working

2) Downloaded WT 3.3.0 and ran CMake on it, as per the tutorials, ensuring that WT_No_Boost_Random was deselected. That is something the tutorials don't seem to mention, but I can't seem to compile WT without deselecting WT_No_Boost_Random. (I found that trick on a YouTube video.)

3) Opened the Visual Studio WT solution created by step 2, and built it with no errors.

4) Tested the "hello" project, which compiled and ran fine.

4) Reopened Visual Studio in Administrator mode, built the "Install" project, which installed the WT libraries and include files to C:\Program Files (x86)\WT

5) Added "C:\Program Files (x86)\WT\include" to the Include Directories box of the VC Directories tab of the Debug | Win32 property page.

6) Added "C:\Program Files (x86)\WT\lib" to the Library Directories box of that same window.

7) created a new Solution in Visual Studio

8) Cut and paste that hello code into the new project, the same code that ran fine inside the WT solution

9) compiled it. It seemed to find the WT #includes no problem at the precompile stage, but it produced "38 unresolved externals" like the one above, and wouldn't compile.

What did I miss? It has to be something in steps 5 and 6, right? Or do I need to bring across more than just the raw C code from the WT solution when I try to test a program in a new solution?

thanks in advance

John


Replies (2)

RE: Unresolved external symbol error when compiling WT apps in Visual Studio - Added by Wim Dumon about 12 years ago

John,

Boost links automatically to its libraries, but Wt does not do that. You have to specify the libraries explicitly (wtd.lib, wt.lib, wthttp.lib, wthttpd.lib - with or without d for debug or release builds, very important) in the Input section of the Linker properties of your projects.

BR,

Wim.

RE: Unresolved external symbol error when compiling WT apps in Visual Studio - Added by John Davidson about 12 years ago

That fixed it. Such a small thing I missed. So many errors! Thanks so much for the tip.

For anyone that follows, I will add the following steps:

6.1) Added "wtd.lib" and "wthttpd.lib" to the Additional Dependencies box on the Linker|Input tab on the Debug | Win32 property page

6.2) (For release builds) Added "wt.lib" and "wthttp.lib" to the Additional Dependencies box on the Linker|Input tab on the Release | Win32 property page. Though be sure to repeat steps 3 and 4 in Release mode, too, to build those lib files.

    (1-2/2)