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

error C2065: 'tzname': undeclared identifier issue on Windows with VS2015 #98

Open
ghost opened this issue Sep 20, 2016 · 7 comments
Open

Comments

@ghost
Copy link

ghost commented Sep 20, 2016

Hi i am installing time package on Visual studio with NPM but it is failing and raising following errors


Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
 time.cc
 win_delay_load_hook.cc
..\src\time.cc(46): error C2065: 'tzname': undeclared identifier [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(46): error C2228: left of '.ToLocalChecked' must have class/struct/union [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(46): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(52): error C2065: 'timezone': undeclared identifier [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(52): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(56): error C2065: 'daylight': undeclared identifier [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
..\src\time.cc(56): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [D:\Abode Nodejs\nodejs\node_modules\time\build\time.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Abode Nodejs\nodejs\node_modules\time
gyp ERR! node -v v4.4.6
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.6
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the time package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs time
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls time
npm ERR! There is likely additional logging output above.

I am using Windows 10 with VS 2015 and all node-gyp dependencies installed. Everything else is working except the time package

@kevin-gtt
Copy link

There is no tzname that I can find here. Where is this supposed to come from?

@jessegranger
Copy link

Same problem. Windows 10 64-bit, VS 2015. Same series of errors.

https://msdn.microsoft.com/en-us/library/htb3tdkc.aspx

The tzname, timezone, and daylight globals used in src/time.cc are prefixed with an underscore in this build configuration.

Just changing these allowed it to build (with the latest node-gyp, 3.4.0 at this time).

diff --git a/src/time.cc b/src/time.cc
index 93889b9..e7802c0 100644
--- a/src/time.cc
+++ b/src/time.cc
@@ -43,17 +43,17 @@ class Time {
     int tznameLength = 2;
     Local<Array> tznameArray = Nan::New<v8::Array>( tznameLength );
     for (int i=0; i < tznameLength; i++) {
-      Nan::Set(tznameArray, i, Nan::New<v8::String>(tzname[i]).ToLocalChecked());
+      Nan::Set(tznameArray, i, Nan::New<v8::String>(_tzname[i]).ToLocalChecked());
     }

     Nan::Set(obj, Nan::New("tzname").ToLocalChecked(), tznameArray);

     // The 'timezone' long is the "seconds West of UTC"
-    Nan::Set(obj, Nan::New("timezone").ToLocalChecked(), Nan::New<v8::Number>( timezone ));
+    Nan::Set(obj, Nan::New("timezone").ToLocalChecked(), Nan::New<v8::Number>( _timezone ));

     // The 'daylight' int is obselete actually, but I'll include it here for
     // curiosity's sake. See the "Notes" section of "man tzset"
-    Nan::Set(obj, Nan::New("daylight").ToLocalChecked(), Nan::New<v8::Number>( daylight ));
+    Nan::Set(obj, Nan::New("daylight").ToLocalChecked(), Nan::New<v8::Number>( _daylight ));

     info.GetReturnValue().Set(scope.Escape(obj));
   }

@bakaproject
Copy link

I'm seeing the same thing. Can we get this fixed? I can submit a pull request.

@sidgate
Copy link

sidgate commented Oct 20, 2016

I am getting the same error on window 10. any solution?

@gtorodelvalle
Copy link

Same here... :( It seems to be a fix for the issue since March, 2016 pending review and merging... :)

@gtorodelvalle
Copy link

I'd say it is already solved thanks to #88 and already merged in https://github.com/TooTallNate/node-time/releases/tag/0.12.0 :) Did you give it a try? Just to ask @TooTallNate to close this issue in case it is already solved ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@gtorodelvalle @bakaproject @sidgate @kevin-gtt @jessegranger and others