[NoBug/Solved] Compilation error due to character encoding

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

ks13
Just popping in
Just popping in
Posts: 17
Joined: Sat May 24, 2014 22:25

[NoBug/Solved] Compilation error due to character encoding

Postby ks13 » Sat May 24, 2014 22:42

Hi,

so i never used this library before, i found it while searching for crossplatform GUI for OpenGL. I followed the video showing how to compile the libraries with it's dependencies, and got a warning with CMake, just for the heck of it i tried to compile it with VS 10 since it said it finished generating, and then i got a compiler error. Not sure if the 2 are related but in the video there are no warnings produced by CMake and compilation works.

The CMake warning :

Code: Select all

CMake Warning (dev) in cegui/src/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "CEGUIBase-0" has an INTERFACE_LINK_LIBRARIES property which differs
  from its LINK_INTERFACE_LIBRARIES properties.

  INTERFACE_LINK_LIBRARIES:

    $<$<NOT:$<CONFIG:DEBUG>>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/freetype.lib>;$<$<CONFIG:DEBUG>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/freetype_d.lib>;$<$<NOT:$<CONFIG:DEBUG>>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/pcre.lib>;$<$<CONFIG:DEBUG>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/pcre_d.lib>;winmm;$<$<CONFIG:DEBUG>:DbgHelp>

  LINK_INTERFACE_LIBRARIES:

   

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in cegui/src/RendererModules/OpenGL/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "CEGUIOpenGLRenderer-0" has an INTERFACE_LINK_LIBRARIES property
  which differs from its LINK_INTERFACE_LIBRARIES properties.

  INTERFACE_LINK_LIBRARIES:

    glu32;opengl32;$<$<NOT:$<CONFIG:DEBUG>>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/glew.lib>;$<$<CONFIG:DEBUG>:F:/Projects/cegui-0.8.3/dependencies/lib/dynamic/glew_d.lib>;CEGUIBase-0

  LINK_INTERFACE_LIBRARIES:

   

This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in cegui/src/CommonDialogs/CMakeLists.txt:
  Policy CMP0022 is not set: INTERFACE_LINK_LIBRARIES defines the link
  interface.  Run "cmake --help-policy CMP0022" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  Target "CEGUICommonDialogs-0" has an INTERFACE_LINK_LIBRARIES property
  which differs from its LINK_INTERFACE_LIBRARIES properties.

  INTERFACE_LINK_LIBRARIES:

    CEGUIBase-0

  LINK_INTERFACE_LIBRARIES:

   

This warning is for project developers.  Use -Wno-dev to suppress it.


The compiler errors :

Code: Select all

Error   6   error C2001: newline in constant    F:\Projects\cegui-0.8.3\samples\FontDemo\Sample_FontDemo.cpp   134   1   CEGUIFontDemo
Error   7   error C2001: newline in constant    F:\Projects\cegui-0.8.3\samples\FontDemo\Sample_FontDemo.cpp   147   1   CEGUIFontDemo
Error   8   error C2001: newline in constant    F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   692   1   CEGUIGameMenuDemo
Error   9   error C2146: syntax error : missing ')' before identifier 'd_botBarLabel'    F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   694   1   CEGUIGameMenuDemo
Error   10   error C2001: newline in constant   F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   717   1   CEGUIGameMenuDemo
Error   11   error C2146: syntax error : missing ')' before identifier 'd_topBarLabel'    F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   719   1   CEGUIGameMenuDemo
Error   13   error C2001: newline in constant   F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   748   1   CEGUIGameMenuDemo
Error   14   error C2146: syntax error : missing ')' before identifier 'd_botBarLabel'    F:\Projects\cegui-0.8.3\samples\GameMenu\GameMenu.cpp   750   1   CEGUIGameMenuDemo


The line from the fontdemo that it talks about is :

Code: Select all

                                (encoded_char*)"+ - ? B I W Y f n t ℹ ⇦ ⇧ ⇨ ⇩ ⌘ ☎ ☐ ☑ ⚖ ⚙ ⚠ ⛏ ✎ ✑ ✓ ✔ ✕ ✖ ❝ ❞ ➡ ⬀ ⬁ ⬂ ⬃ ⬅ ⬆ ⬇ ⬈ ⬉ ⬊ ⬋                       "


for the first error,

Code: Select all

                                    "  "


for the second and

Code: Select all

    finalText += reinterpret_cast<const encoded_char*>("❚");


for the others (same code different line/file).

All errors seem to be from the demo files, so i'm not sure if i should exclude them from the compilation or not.
Last edited by ks13 on Sun May 25, 2014 22:51, edited 1 time in total.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Error with Generation and Compilation of the libra

Postby Ident » Sun May 25, 2014 11:45

I use VS2010 and I have never seen this error. You can try to deactivate the FontDemo-only in CMake and see if you can compile the rest then. Also I would like to ask you to try the v0-8 branch from our bitbucket repo and see if the error persists. The warning should be gone in that branch btw, it came up with newer CMAke versions and will be incorporated in the next release. The quoted warning can be ignored.

Considering the other errors your get - here an explanation: The Font demo uses unicode characters that CEGUI is actually able to understand and display. Even though they might not be able to be displayed in editors not supporting unicode, this should still not be an issue. I wonder why it works on my setup and on timotei's as well. We both use VS 2010 and had no issues. Maybe another user has an idea? Or maybe you can google a bit and see if you find a solution. I m out of ideas here. WHat exact VS 2010 version are you using?
CrazyEddie: "I don't like GUIs"

ks13
Just popping in
Just popping in
Posts: 17
Joined: Sat May 24, 2014 22:25

Re: [Bug] Error with Generation and Compilation of the libra

Postby ks13 » Sun May 25, 2014 21:01

Ok, i got the v0-8 branch, and used cmake to generate the build, then tried to compile, but got an error about some XML defines, and a lib it can't find/open :

Code: Select all

Warning   1   warning C4003: not enough actual parameters for macro 'S_'   F:\Projects\cegui-cegui-6720a5b3a4c7\cegui\src\System.cpp   105   1   CEGUIBase-0
Error   2   error C2063: 'CEGUI::System::d_defaultXMLParserName' : not a function   F:\Projects\cegui-cegui-6720a5b3a4c7\cegui\src\System.cpp   105   1   CEGUIBase-0
Warning   3   warning C4003: not enough actual parameters for macro 'S_'   F:\Projects\cegui-cegui-6720a5b3a4c7\cegui\src\System.cpp   107   1   CEGUIBase-0
Error   4   error C2063: 'CEGUI::System::d_defaultImageCodecName' : not a function   F:\Projects\cegui-cegui-6720a5b3a4c7\cegui\src\System.cpp   107   1   CEGUIBase-0
Error   5   error LNK1104: cannot open file '..\..\..\lib\CEGUIBase-0_d.lib'   F:\Projects\cegui-cegui-6720a5b3a4c7\build\cegui\src\CommonDialogs\LINK   CEGUICommonDialogs-0
Error   6   error LNK1104: cannot open file '..\..\..\..\lib\CEGUIBase-0_d.lib'   F:\Projects\cegui-cegui-6720a5b3a4c7\build\cegui\src\WindowRendererSets\Core\LINK   CEGUICoreWindowRendererSet
   7   IntelliSense: member function "CEGUI::System::d_defaultXMLParserName" may not be redeclared outside its class   f:\projects\cegui-cegui-6720a5b3a4c7\cegui\src\system.cpp   105   16   CEGUIBase-0
   8   IntelliSense: member function "CEGUI::System::d_defaultImageCodecName" may not be redeclared outside its class   f:\projects\cegui-cegui-6720a5b3a4c7\cegui\src\system.cpp   107   16   CEGUIBase-0


Also, i tried compiling the 0.8.3 version without the 2 parts that are producing the errors, and i got another error. I am a a student in an international program currently living in China. It seems that the usual unicode is replaced with China simplified unicode which is causing all those errors. The actual error message says the following :
"Some bytes have been replaced with Unicode substitution character while loading file *project_folder*/func_common.hpp with Chinese Simplified (GB2312) encoding. Saving the file will not preserve the encoding"

added to that, the following compiling warning :

Code: Select all

Warning   1   warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss   F:\Projects\cegui-0.8.3\samples\FontDemo\Sample_FontDemo.cpp   1   1   CEGUIFontDemo


makes me think that the cause of those errors is that my system has been slightly adapted to Chinese Simplified encoding for a project i had to do. Since i'll be going back at the end of the week, i'm going to clean my system and try again after i'm home, hoping that solves the problem.

Edit : my VS2010 version is 10.0.40219.1 SP1Rel with .Net 4.5.50938 SP1Rel on Windows 7.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Error with Generation and Compilation of the libra

Postby Ident » Sun May 25, 2014 21:53

Please stop converting files automatically and it will work. Ii guess you can change this somewhere in visual studio?

Obviously if you change all CEGUI files to a different encoding this can lead to problems with unicode character encodings that support more than just Chinese, which is the case with our files in the Font Demo.
CrazyEddie: "I don't like GUIs"

ks13
Just popping in
Just popping in
Posts: 17
Joined: Sat May 24, 2014 22:25

Re: [Bug] Error with Generation and Compilation of the libra

Postby ks13 » Sun May 25, 2014 22:10

As it is, i didn't see any log or anything about converting files in VS, maybe it was done by Windows when i extracted them? In which case i don't think it's possible to deactivate. Also, i never had to add another encoding system before, so i didn't know it converted whole files to the new standard.

Edit : once i turned my brain on, i found the solution to the problem, and thank god i didn't have to convert back all of the source files of the solution. This is in case other people might run into the same problem :

If the compiler points out the files that can't compile because of unicode encoding, converting them to unicode is done by opening the concerned file (yes, it need to be done one by one, at least for VS 2010), clicking on File -> Advanced Save Options then choose "Unicode - Codepage 1200" (need to be that one, others don't seem to work). Once it's validated, the files need to be saved (Ctrl + s).

I finished compiling without a problem once i converted them. Now i can finally get to business.

Edit 2 : i have no idea why Windows is converting the files to Chinese encoding, but i checked and all the files i checked were converted to that format, and it seems it's not coming from VS (guess Windows has some kind of agent converting files so it stays compatible with the local environment).
Last edited by ks13 on Sun May 25, 2014 22:44, edited 2 times in total.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug] Error with Generation and Compilation of the libra

Postby Ident » Sun May 25, 2014 22:23

To be honest this is new to me too. But I never used a Chinese localised operating system or program so naturally I can't have experienced it. Since you reported this issue this thread will definitely help others with the same problem, though.

What we would need now to know is what converted your files. You said the extraction did, but arent the v0-8 repository files also converted? Or did you also extract them from some archive?
CrazyEddie: "I don't like GUIs"

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Bug/Solved] Error with Compilation of the library

Postby Ident » Sun May 25, 2014 23:09

I see you have now edited your response with a solution. Thanks a lot for providing a solution completely on your own! I will edit the topics so it will be easier to find for others.
CrazyEddie: "I don't like GUIs"

ks13
Just popping in
Just popping in
Posts: 17
Joined: Sat May 24, 2014 22:25

Re: [NoBug/Solved] Compilation error due to character encodi

Postby ks13 » Sun May 25, 2014 23:50

Well, thanks to you mentioning the conversion of the files, it hit me that the warning gotten from the compiler is the key to the problem. So i searched for that problem on the net and found it pretty fast, but before that i wasn't really sure what might have been related to the error, or not.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 10 guests