Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 10 BUILD_SHARED_LIBS ON localtime_r error , __declspec(dllimport) syntax error #343

Closed
ghost opened this issue Jul 12, 2018 · 2 comments
Labels

Comments

@ghost
Copy link

ghost commented Jul 12, 2018

OS : Windows 10 - Visual studio 2017

I am trying to build glog from the source with BUILD_SHARED_LIBS flag ON, but i got a lot of __declspec(dllimport) syntax error that relate to following line in the code :
#ifndef HAVE_LOCALTIME_R
extern struct tm* GOOGLE_GLOG_DLL_DECL localtime_r(const time_t* timep, struct tm* result);
#endif // not HAVE_LOCALTIME_R
// port.h line 159

also another error at logging.cc line 992. as following
localtime_r identifier not found
....>> localtime_r(&timestamp, &tm_time);

I attached screenshot for farther clarification
screenshot 37

@dzung-hoang
Copy link
Contributor

dzung-hoang commented Jul 14, 2018

I fixed this by moving GOOGLE_GLOG_DLL_DECL ahead of struct tm*.

extern GOOGLE_GLOG_DLL_DECL struct tm* localtime_r(const time_t* timep, struct tm* result);

I learned this from this article:
Error C2059: syntax error : '_ declspec(dllexport)'

@sergiud
Copy link
Collaborator

sergiud commented Jul 14, 2018

@dzung-hoang Great! Could you create a pull request with this fix?

@sergiud sergiud added the bug label Jul 14, 2018
sergiud added a commit that referenced this issue Jul 16, 2018
Fix errors with BUILD_SHARED_LIBS=ON for Visual Studio 2017 (fixes #343)
durswd pushed a commit to durswd/glog that referenced this issue Sep 2, 2019
Fix errors with BUILD_SHARED_LIBS=ON for Visual Studio 2017 (fixes google#343)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants