Project

General

Profile

Project configuration - newbie issue

Added by James Adams almost 11 years ago

Hello Everybody!

I've just discovered Wt and installed it this weekend. It's been nearly 10 years since I actively did any C work and even then it wasn't on Visual Studio so please regard me as pretty much a beginner.

I am using a clean install of Visual Studio 2008 C on a clean Windows 7 Pro 64 virtual machine.

I have successfully installed and tested Boost. I decided to compile my own Wt install rather than use the pre-compiled binaries (partially for my own practice as its been a while).

The Wt install successfully built, I have opened the included Wt.sln and I'm happily running the examples and going through the tutorials.

The issue is with configuring a brand new project / solution of my own which I shall use to build my application. I've currently just built a quick "Hello World" example to test and I am obtaining build errors in relation to library linking (I think). I have so far completed the following:

1) Open Visual Studio and created a new project - Win 32 Console Application, Empty Project ticked.

2) Added a new source .cpp file and named it main.cpp (see bottom of post for copy of the program).

3) Added the following to Project Properties (note: I have ONLY added the following items, everything else remains as default):

Boost and Wt include directories. Added to: C/C > General > Additional Include Directories:

"C:\Program Files\Wt\wt-3.3.2\build";"C:\Program Files\Wt\wt-3.3.2\src";"C:\Program Files\boost\boost_1_55_0";

Boost and Wt included libraries. Added to: Linker > General > Additional Library Directories:

"C:\Program Files\Wt\wt-3.3.2\build\src";"C:\Program Files\boost\boost_1_55_0\stage\lib"

Reference to wtd.lib and wthttpd.lib library files. Added to Linker > Input > Additional Dependencies:

"C:\Program Files\Wt\wt-3.3.2\build\src\Debug\wtd.lib" "C:\Program Files\Wt\wt-3.3.2\build\src\http\Debug\wthttpd.lib"

(Note: to me it seems logical that there should be a semi-colon between the "" items but the VS gui auto-generates the above and it doesn't seem to like it if I insert one)

Added the following debugging command arguments ready for testing: Debugging > Command Arguments:

---http-address=0.0.0.0 ---http-port=8080 ---deploy-path=/hello ---docroot=.

When I attempt to build the project I get the following errors:

--------- Build started: Project: WtBasic, Configuration: Debug Win32 ---------

Linking...

Creating library C:\Users\Owl\Documents\Visual Studio 2008\Projects\WtBasic\Debug\WtBasic.lib and object C:\Users\Owl\Documents\Visual Studio 2008\Projects\WtBasic\Debug\WtBasic.exp

wthttpd.lib(Request.obj) : error LNK2019: unresolved external symbol _imp_StrStrIA@8 referenced in function "public: bool __thiscall http::server::buffer_string::icontains(char const *)const " (?icontainsbuffer\_string@server@http@@QBE\_NPBDZ)

C:\Users\Owl\Documents\Visual Studio 2008\Projects\WtBasic\Debug\WtBasic.exe : fatal error LNK1120: 1 unresolved externals

Build log was saved at "file://c:\Users\Owl\Documents\Visual Studio 2008\Projects\WtBasic\WtBasic\Debug\BuildLog.htm"

WtBasic - 2 error(s), 0 warning(s)

Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped

I've tried tweaking references to file and directory locations in the properties without success.

I've also cross compared to the Properties in the Wt.sln but this appears to have some significant differences and relates to RelWithDebInfo - I'm not entirely sure what that's all about yet, I need to do some background reading on VS - but I don't believe its necessary to get my project working in Debug mode.

Any assistance in resolving the build errors would be much appreciated.

Thanks

James

Program: (extract from excellent series of tutorials by Andres Jaimes - http://andres.jaimes.net/780/how-to-create-a-first-application-using-wt-witty/)

#include

#include

#include

using namespace Wt;

class ControlExample: public WContainerWidget {

public:

ControlExample(WContainerWidget *parent = 0): WContainerWidget(parent) {

addWidget(new WText("Hello World!"));

}

};

WApplication* createApplication(const WEnvironment &env) {

WApplication* app = new WApplication(env);

app->setTitle("Control Test");

app~~root()~~>addWidget(new ControlExample());

return app;

}

int main(int argc, char argv) {

return WRun(argc, argv, &createApplication);

}


Replies (3)

RE: Project configuration - newbie issue - Added by Alexey Chemakin almost 11 years ago

Hi!

I also a newbie, but could suppose leak of Shlwapi.lib in additional dependencies.

When I created my own project I saw all properties from Wt examples and copied them to my project properties.

And now I have in additional dependencies the following libs:

kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;..\..\src\http\Debug\wthttpd.lib;..\..\src\Debug\wtd.lib;winmm.lib;ws2_32.lib;mswsock.lib;Shlwapi.lib;..\..\..\src\Wt\Dbo\Debug\wtdbod.lib;..\..\..\src\Wt\Dbo\backend\Debug\wtdbopostgresd.lib;D:\Program Files\PostgreSQL\9.3\lib\libpq.lib;C:\Boost\lib\libboost_date_time-vc110-mt-gd-1_53.lib;vld.lib

The last vld.lib - is for VLD memory debugging tools.

Best regards,

Alexey

RE: Project configuration - newbie issue - Added by Wim Dumon almost 11 years ago

That's correct. I eliminated the shlwapi.lib dependency in the next version, since it caused more trouble than it solved.

Best regards,

Wim.

RE: Project configuration - newbie issue - Added by James Adams almost 11 years ago

Alexey / Wim

Thanks ever so much!

Adding Shlwapi.lib resolved the issue. Added to Linker > Input > Additional Dependencies as follows:

"C:\Program Files\Wt\wt-3.3.2\build\src\Debug\wtd.lib" "C:\Program Files\Wt\wt-3.3.2\build\src\http\Debug\wthttpd.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\Shlwapi.lib"

I also intend on using PostgreSQL so I'm sure the other libraries Alexey referenced will also come in handy at some point shortly.

Thanks

James

    (1-3/3)