I've written the following simple program:
#include "stdafx.h"
#include <gflags/gflags.h>
#include <glog/logging.h>
#include <ostream>
int _tmain(int argc, char* argv[])
{
google::InitGoogleLogging(argv[0]);
LOG(INFO) << "Found";
return 0;
}
I checked out google-glog from here: http://code.google.com/p/google-glog/source/checkout
And I've checked out google-gflags from here: http://code.google.com/p/google-gflags/
I have all three of these projects in Visual Studio 2010 Express, all under the same solution:
- Solution
- GoogleLibsTest
- libgflags
- libglog
When I compile it, I get the following error:
1>------ Build started: Project: GoogleLibsTest, Configuration: Debug Win32 ------
1>GoogleLibsTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall google::LogMessage::~LogMessage(void)" (__imp_??1LogMessage@google@@QAE@XZ) referenced in function _wmain
1>GoogleLibsTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_ostream<char,struct std::char_traits<char> > & __thiscall google::LogMessage::stream(void)" (__imp_?stream@LogMessage@google@@QAEAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@XZ) referenced in function _wmain
1>GoogleLibsTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall google::LogMessage::LogMessage(char const *,int)" (__imp_??0LogMessage@google@@QAE@PBDH@Z) referenced in function _wmain
1>GoogleLibsTest.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl google::InitGoogleLogging(char const *)" (__imp_?InitGoogleLogging@google@@YAXPBD@Z) referenced in function _wmain
1>C:\Users\leeand00\Desktop\glogNgflagsTest\GoogleLibsTest\Debug\GoogleLibsTest.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
I've done several things to try and fix this including:
In the Solution Property page Selecting Common Properties Project>Dependencies and setting the GoogleLibsTest to depend on the other two projects.
In the GoogleLibsTest Property page
Adding libgflags-debug.lib libglog_static.lib to the Configuration Properties>Linker>Input>Additional Dependencies list.
In Configuration Properties>VC++ Directories I added the directory containing libgflags-debug.lib and libglog_static.lib to the list of library directories.
In Configuration Properties>C/C++>General>Additional Include Directories added the paths to the <glog-base-dir>\src\windows (since this is where the header files are for glog)
In Configuration Properties>C/C++>General>Additional Include Directories added the paths to the <gflags-base-dir>\src\windows (since this is where the header files are for gflags)
For some reason it is looking for a dll file (I don't know why that is)
Is there anything else I'm missing?