Select "Use Unicode Character Set" in Gnu Makefile - unicode

I have a long-standing application that I'm normally able to compile equally well from Visual Studio or from a makefile using Gnu Make (but still using the Microsoft C++ compiler).
Recently I modified it by incorporating a third-party library. On trying to compile it for the first time from within Visual Studio, I obtained the common "C2664: ...cannot convert parameter 1 from 'const char *' to 'LPCWSTR'" error, which I resolved by going to the 'General' tab in the Project Properties dialog and selecting the "Use Unicode Character Set" option.
I'd now like to compile the application from my makefile, but naturally I get the same error. Is there a compiler switch that I can use to have an equivalent effect to "Use Unicode Character Set", or any other way of effecting this from within the makefile?

It's not a dedicated compiler switch. Unicode is selected based on preprocessor macros. IIRC, UNICODE for MFC and _UNICODE for the MSVCRT. Use /D UNICODE /D _UNICODE.

Related

Spring-Boot executable encoding

My Rest-Application delivers data in correct encoding when running under Eclipse. But when I start the application as executable jar on a Windows System, my special characters are broken.
What am I missing?
Eclipse
Eclipse's encoding is set in preferences->general->workspace, which whould by default be inherited from the OS (cp1250 on windows).
When you create a "Run as" task, it also stores it. So if you update eclipse's setting, make sure you re-create your "run as" task. You can see the actual value used when launching your application: Run configurations... -> Your Run task -> Common tab.
You can also force an encoding in eclipse.ini by adding -Dfile.encoding=AnotherEncoding at the end.
Command line
When launching from the command line, it takes the system default value, which would be cp1250 on whidows.
You could print the encoding at the very first line of your program, just to see: System.out.println(System.getProperty("file.encoding"));
To specify an encoding from the command line: java -Dfile.encoding=UTF-8 yourApp.jar
See also
Take a look at this too: https://stackoverflow.com/a/14867904/641627
This indicates a problem with your code. Your code is currently
depending on the default platform encoding, and doesn't work if that
encoding is not "UTF-8". therefore, you should change the places in
your code which depend on the default platform encoding to use the
"UTF-8" encoding explicitly.

compile qt code using gcc in ubuntu

I am new with Linux. I want to compile my code which written in qt creator using gcc in terminal. I don't know how should I do this task. the output will be called in Matlab. please give me information in this area. I search through the internet but i didn't find useful information to solve my problem.
Thanks
In QT Creator select "New project" -> Non-QT project -> plain C or C++ application, you can then edit your source in QT Creator, go to a Terminal & compile it using gcc or make your own makefile. From the Matlab instructions "The exclamation point character (!) sometimes called bang, is a shell escape. The character indicates that the rest of the input line is a command to the operating system. Use it to invoke utilities or call other executable programs without quitting MATLAB®".

Xemacs perl compilation can't go to error position, by showing "Wrong type argument" error

After compilation of perl script I get syntax error in compilation window. If I try to use Goto Error Command, it not working and show error message:
Wrong type argument: listp, "^\\s-*\\(at \\(.*\\):\\([0-9]+\\)\)"
I use cperl 6.2 and xemacs 21.5.34.
I change to GNU Emacs. How can I enable perl syntax check? I run cperl but syntax check is disabled?
CPerl's "Check syntax" menu item relies on something called mode-compile. If you don't have that installed it won't work. I've never used mode-compile, and can't offer much help there.
If you're going to be installing another package for syntax checking anyway, and assuming you're using GNU Emacs 24 or later, I suggest using the excellent Flycheck instead. Flycheck supports syntax checking for Perl as well as a huge number of other languages. In addition to regular syntax checking using the perl binary, Flycheck also supports syntax checking using Perl::Critic.
Flycheck is available via MELPA and MELPA stable. Once it is installed, add
(global-flycheck-mode)
to your configuration to enable Flycheck globally. If you've got perl on your path you should start getting syntax checking.

Can't make Eclipse (Luna) PyDev console use UTF-8

In Eclipse Luna (4.0.4) / Python 3.4.1 I can't get the PyDev 3.6.0 console to work with Unicode despite having tried several recommended corrective steps.
I attempted this example in Dive Into Python 3: http://www.diveintopython3.net/files.html
If I do the example's a_file.read(), the PyDev console displays:
'Dive Into Python \u662f\u4e3a\u6709\u7ecf\u9a8c......' instead of 'Dive Into Python 是为有经验的程序员编写的一本...'
If I paste the Chinese characters into the PyDev console ala cstring = '是为有经验的程序员编写的一本', then in the console type "cstring ENTER', I again get '\u662f\u4e3a\u6709\u7ecf\u9a8c...'
If I then try print(cstring), I get the following error:
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-13: character maps to
I don't know what do do with that information. The cp1252.py bit is at the heart of my confusion because I've told Eclipse and PyDev to use UTF-8 in every place I can find to do that, beginning with the information in the following:
Printing Unicode in eclipse Pydev console and in Idle
However, I cannot modify "site.py" as described in those steps because [EclipseInstallDir]/lib/site.py does not contain "encoding = ".
I can't figure out what to do next.
For regular runs:
The problem there is that the PYTHONIOENCODING is overridden by PyDev based on the encoding you used in the run configuration (which is the encoding used by the console view too -- so, it'd make no sense having a PYTHONIOENCODING with a value and the allocated console in the PyDev side with another value).
You can change the encoding you're using for a run configuration in:
Run > Run configurations > common > encoding.
By default it'll use the encoding of the file being launched (you can change the default encoding for the workspace in general > workspace > text file encoding).
For interactive console runs:
For interactive console runs there's currently no API to change the encoding in the java side, so, one has to start Eclipse itself in a VM that uses UTF-8 by default... In practice, this means that you have to add:
-Dfile.encoding=UTF-8
to the vmargs of Eclipse in eclipse.ini (and in this case it's also recommended to set the PYTHONIOENCODING environment variable in the related interpreter and set it to UTF-8).
Found it! (At least for Python 3.4.1, Eclipse Luna 4.0.4, PyDev 3.6.0.)
In Eclipse, in Preferences —> PyDev —> Interpreters —> Python Interpreter, in the Environment tab, I added the environment variable PYTHONIOENCODING and specified its value as utf-8.
The PyDev Interactive Console now properly displays the aforementioned Chinese characters (and Thai characters, too).

How to change the line ending used in Netbeans

Netbeans has this wiki entry on line endings: http://wiki.netbeans.org/FaqEditorEOLs
But it isn't very useful. It just says that you shouldn't develop on different OS and that's that...
In my situation however, I have no power over it. I'm on a windows machine and the PHP app I'm working on needs to end with the UNIX EOL.
There does not seem to be an option to set this for new files. Can anyone tell me where to set this?
Just saw that you can set this as a command-line startup flag: -J-Dline.separator=LF
I haven't tested this myself but I'm looking for ways to bake this into the configs somehow.
Since, a specific plug-in came out: http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=36810
I also like #JimLewis suggestion but I work on Windows with a linux virtual machine thus in some cases the versioning system line ending cannot help.
[update 201709]
I no longer use netbeans (sorry, but I need python support and it's too buggy) and almost no longer develop on windows, but #marinos-an in a comment suggests https://github.com/welovecoding/editorconfig-netbeans which uses a common setting file that can be picked up by multiple editors through plugins. Definitely interesting to try since the settings file is committable!
Have you considered managing the line endings at the version control level? Subversion,
for example, lets you set an "eol-style" attribute with values "LF", "CR", "CRLF",
and "native" (which translates the line endings stored in the repository to whatever
is appropriate for the platform where the files are being checked out, and converts
the other way when you check in.)
Please use following Netbeans Plugin
http://plugins.netbeans.org/plugin/36810/show-and-change-line-endings
fentie's answer solved my problem with line endings, as pasting multi-line MySQL from NetBeans into the MySQL command prompt caused errors.
To pass this argument to NetBeans every time it opens, add it to the netbeans.conf file:
/Applications/NetBeans/NetBeans\ 7.1.2.app/Contents/Resources/NetBeans/etc/netbeans.conf on OS X.
From the NetBeans Mac page under Tips & Tricks.
When I pasted multi-line SQL statements from NetBeans to the MySQL command line client on OS X or a remote Linux server, MySQL would list all possible command choices, give me some strange '> type of prompt and I was forced to hit Ctrl+C and log back into MySQL again.
For my Netbeans 12.6
I found a pluging called "Change Line Endings on Save"
https://plugins.netbeans.apache.org/catalogue/?id=31
more details are there
https://github.com/junichi11/netbeans-change-lf
once pluging installed you can configure EOL in there:
Tools > Options > Editor > Line Endings