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 C2220 #76

Closed
BlackFH opened this issue Mar 3, 2017 · 6 comments
Closed

error C2220 #76

BlackFH opened this issue Mar 3, 2017 · 6 comments

Comments

@BlackFH
Copy link

BlackFH commented Mar 3, 2017

Hello,I follow the steps but encountered an error c2220 while running build.cmd.
and I try to disable treat warnings as errors but it`s not work.
Is that because my system language is Chinese?
qq 20170303195654

qq 20170303194144

@clovett
Copy link
Contributor

clovett commented Mar 3, 2017

Looks like the file contains a character that cannot be returned in your code page, see https://msdn.microsoft.com/en-us/library/ms173715.aspx. Can you try saving that for (half.h) as utf8 ?

@lovettchris
Copy link
Member

I have verified that this file from the Eigen library does indeed contain characters that should have been encoded at UTF-8. This is how I did it. When I use Visual Studio to save the file with ansii encoding like this:
encoding
then you will see Visual Studio correctly report the error:
encoding_error

But if you save it with this encoding then everything is fine, and this should work on your machine.
encoding_utf8

But the characters in the file that are causing this problem are probably in every single Eigen file because it is part of the copyright header. Specifically it is the special curly quotes used in this part of the header:

“AS IS”

If you replace the curly quotation characters with simple double quotes "" then that should also fix it.

Technically this is a bug in the Eigen library, they should have UTF-8 encoded all their files. So if you have a tool that can utf-8 encode all the Eigen files then I would use that just in case there are any other special characters used anywhere. Trick is that tool probably needs to load them as Western European Codepage 28591, and not the default code page of the system. It is your default code page that does not contain those special characters.

@BlackFH
Copy link
Author

BlackFH commented Mar 4, 2017

Thanks Chris,also thanks for Clovett's reply.It's strange that Visual Studio will still report the error after I saved the file with UTF-8 encoding.However,the problem is solved after I replaced the curly quotation characters.I'm sorry about my poor English.I will close this issue.

@BlackFH BlackFH closed this as completed Mar 4, 2017
@clovett
Copy link
Contributor

clovett commented Mar 4, 2017

You're English is fine, thanks for closing. I'll follow up with vc complete this on why this happened. Turns out the file was utf8 expires it just doesn't have a bite order Mark....

@lovettchris
Copy link
Member

By the way there is a way to fix this using /utf-8 compiler flag, if you add this to the mSVC section of the CMakeLists.txt:
set(RPCLIB_BUILD_FLAGS "/utf-8")

More info here: https://forum.kde.org/viewtopic.php?f=74&t=139230.

@whxru
Copy link

whxru commented Aug 31, 2018

It's not ok for me to save half.h with encoding UTF-8, but UTF-8 with BOM works correctly.

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

4 participants