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

'toupper': is not a member of 'std' #1848

Closed
wxfred opened this issue Jul 8, 2021 · 8 comments · Fixed by #1960
Closed

'toupper': is not a member of 'std' #1848

wxfred opened this issue Jul 8, 2021 · 8 comments · Fixed by #1960
Assignees
Labels

Comments

@wxfred
Copy link

wxfred commented Jul 8, 2021

Issue

Win10 electron project
After installing all dependencies, rebuild canvas

..\node_modules\canvas\src\util.h(32): error C2039: 'toupper': is not a member of 'std'
c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\map(20): note: see declaration of 'std'

then, I changed the source code from

inline bool streq_casein(std::string& str1, std::string& str2) {
  return str1.size() == str2.size() && std::equal(str1.begin(), str1.end(), str2.begin(), [](char& c1, char& c2) {
    return c1 == c2 || std::toupper(c1) == std::toupper(c2);
  });
}

to

inline bool streq_casein(std::string& str1, std::string& str2) {
  return str1.size() == str2.size() && std::equal(str1.begin(), str1.end(), str2.begin(), [](char& c1, char& c2) {
    return c1 == c2 || toupper(c1) == toupper(c2);
  });
}

Another error came out

Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)" (__imp_?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_p
tr@VBackingStore@v8@@@std@@XZ)

I have no idea about that.

Your Environment

win10
canvas 2.8.0
node v12.19.0
node-gyp v5.1.0
GTK 2
libjpeg-turbo-2.0.6-vc64.exe

@919485590
Copy link

same quesion in my environment:

npm ERR! e:\git_new\sprite-v3\node_modules\canvas\src\util.h(31): error C2039: "toupper": is not a member of "std" [E:\git_new\sprite-v3\node_modules\canvas\build\canvas.vcxproj]
npm ERR!   c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.16.27023\include\map(20): note: 参见“std”的声明
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.3 | win32 | x64
npm ERR! gyp info find Python using Python version 2.7.18 found at "C:\Python27\python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1525) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Python27\python.exe

@wxfred
Copy link
Author

wxfred commented Jul 11, 2021

@919485590 Unfortunately, there is no simple solution recently. I'll try to build my exe with my mac or a linux.
nodejs/nan#892 (comment)

@sunqibuhuake

This comment has been minimized.

@wangxdmm
Copy link

wangxdmm commented Sep 5, 2021

solved by mapbox/node-pre-gyp#526 (comment)
npm 7.22.0
node 14.17.5

@plus1998
Copy link

plus1998 commented Oct 6, 2021

这个报错是nan编译时抛出来的,我测试通过的解决方案:

  1. 手动安装nan@2.14.0
  2. 删除/node_modules/canvas/node_modules/nan/文件夹
  3. 执行electron-rebuild
  4. 抛出toupper异常再根据你的方法修改
  5. 执行electron-rebuild

@zbjornson
Copy link
Collaborator

The second error (unresolved external symbol "__declspec(dllimport) public: class std::shared_ptr<class v8::BackingStore> __cdecl v8::ArrayBuffer::GetBackingStore(void)...) is addressed in v2.9.0 (#1944, affects Node.js v14+). You can also reinstall from scratch (delete node_modules) so that a newer version of Nan gets installed.

The first issue should be fixed by #1960.

@zbjornson zbjornson self-assigned this Dec 31, 2021
@zbjornson zbjornson added the Bug label Dec 31, 2021
@919485590
Copy link

919485590 commented Dec 31, 2021 via email

zbjornson added a commit that referenced this issue Jan 22, 2022
zbjornson added a commit that referenced this issue Jan 22, 2022
@919485590
Copy link

919485590 commented Jan 22, 2022 via email

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

Successfully merging a pull request may close this issue.

6 participants