0

We have a legacy c++ project written by visual studio 2005. we want to replace it's internal logger with log4cpp. I downloaded version 1.1.3. But there is no ready-to-use solution for vs2005. So i created an empty win32 project:

Configuration type: Static Library (.lib)

And added by hand all .cpp and .hh files to it and compiled it.

It compiled with 5 errors at the end: https://gist.github.com/LinArcX/c66dc8bd5afa1868e79feef841a3af23

It complains about some identifier that didn't find:

1>d:\mylog4cpp\src\dailyrollingfileappender.cpp(55) : error C3861: 'time': identifier not found
1>d:\mylog4cpp\src\dailyrollingfileappender.cpp(62) : error C3861: 'localtime_s': identifier not found
1>d:\mylog4cpp\src\dailyrollingfileappender.cpp(95) : error C3861: 'time': identifier not found
1>d:\mylog4cpp\src\dailyrollingfileappender.cpp(155) : error C3861: 'time': identifier not found
1>d:\mylog4cpp\src\dailyrollingfileappender.cpp(160) : error C3861: 'localtime_s': identifier not found

I've tried to add time.h to dailyrollingfileappender.cpp, but got another errors: https://gist.github.com/LinArcX/1ab580bb4860eaddd374dcadd6b5211b

linarcx
  • 116
  • 3
  • 17
  • 1
    You need to link with `Ws2_32.lib` and possibly others. You should be able to search for all of those function names and find the library it belongs to. – Retired Ninja Aug 14 '21 at 11:34
  • 1
    define _CRT_SECURE_NO_DEPRECATE in one of your common headers, or build project. And indeed link to ws2_32.lib. You can force this with adding #pragma comment(lib, "ws2_32.lib") to a source or header file – Pepijn Kramer Aug 14 '21 at 11:41

0 Answers0