reSIProcate on WinRT - c++

I'm getting stuck with building reSIProcate on WinRT. I got a syntax error in reTurnClient project( method getSocketDescriptor, in TurnTlsSocket.hxx)
This is error line code:
virtual unsigned int getSocketDescriptor() { return mSocket.lowest_layer().native(); }
This is error log:
5>e:\work\sigma\qilex-windows\resiprocate-resiprocate-1.10.1\return\client\TurnTlsSocket.hxx(23): error C2440: 'return': cannot convert from 'Windows::Networking::Sockets::StreamSocket ^' to 'unsigned int' (compiling source file TurnTlsSocket.cxx)
5> e:\work\sigma\qilex-windows\resiprocate-resiprocate-1.10.1\return\client\TurnTlsSocket.hxx(23): note: No user-defined-conversion operator available, or (compiling source file TurnTlsSocket.cxx)
5> e:\work\sigma\qilex-windows\resiprocate-resiprocate-1.10.1\return\client\TurnTlsSocket.hxx(23): note: There is no context in which this conversion is possible (compiling source file TurnTlsSocket.cxx)
I know It's type conflict error, but haven't got any clue to start fixing.

Related

What the underlying reason C code will compile using mingw32 in Linux but Visual Studio C has problems

So Im wondering why C code compiled for me with mingw32 (this program here fo reference https://github.com/newsoft/adduser) with no issues or mentions of errors (other than some case-sensitivity in naming of the headers i mean)
Though, when I tried in Visual Studio 2019 I get the following "errors" that need to be cleaned up.
Error C2440 '=': cannot convert from 'const wchar_t [15]' to 'LPWSTR' adduser-test2 C:\Users\Administrator\source\repos\adduser-test\adduser-test2\adduser-test2.cpp 39
Error C2440 '=': cannot convert from 'const wchar_t [6]' to 'LPWSTR' adduser-test2 C:\Users\Administrator\source\repos\adduser-test\adduser-test2\adduser-test2.cpp 38
Is it some sort of strict compiler settings for "safer code"? Or is one compiler actually just able to convert a const wchar_t could convert to a pointer to a wchar_t if necessary

Error C2632: 'char' followed by 'int' is illegal after migrating QT4.2.8 to QT5.5.0

After migrating my c++ project from QT version 4.2.8 to version 5.5.0 I get the following errors while compiling for some of my files:
C:\program files (x86)\microsoft sdks\windows\v7.0a\include\rpcndr.h(162): error C2632: 'char' followed by 'int' is illegal
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\wtypes.h(1123): error C2371: 'BOOLEAN' : redefinition; different basic types
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(959) : see declaration of 'BOOLEAN'
95% of my project is compiling, but the last piece is missing and I don't know where to look anymore.
When I open file rpcndr.h, the error is thrown on the last line of this piece of code.
define small char
typedef unsigned char byte;
typedef byte cs_byte;
typedef unsigned char boolean;
Nowhere in the whole project I use the word boolean, so I don't know where the error message is coming from.
Does anybody have has the same problem? Or maybe kowns the solution?
I don't know anymore.

How to import existing OpenSsl project into Xcode

I would like to modify the existing Openssl project. So I downloaded the source code of openssl from GitHub https://github.com/openssl/openssl
and follow the instruction http://openssl.6102.n7.nabble.com/Easy-inclusion-of-OpenSSL-into-iOS-projects-agileinfoways-com-td48905.html on how to include Openssl into Xcode.
However, when i tried to build one of the file (enc.c) from OpenSsl project, it run into 6 errors and 7 warning.
/usr/local/opt/openssl/include/openssl/ecdsa.h
/usr/local/opt/openssl/include/openssl/ecdsa.h:295:14: Parameter
'flags' not found in the function declaration
/usr/local/opt/openssl/include/openssl/ecdsa.h:301:14: Parameter
'ecdsa_method' not found in the function declaration
/usr/local/opt/openssl/include/openssl/ecdsa.h:302:14: Parameter 'name' not found in the function declaration
/Users/maggie/Documents/aes/openssl-master/apps/apps.h
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:421:1: Unknown type name '__owur'
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:421:8: Expected identifier or '('
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:432:1: Unknown type name '__owur'
/Users/maggie/Documents/aes/openssl-master/apps/apps.h:432:8: Expected identifier or '('
/Users/maggie/Documents/aes/openssl-master/apps/progs.h
/Users/maggie/Documents/aes/openssl-master/apps/progs.h:25:1: Type specifier missing, defaults to 'int'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:542:47: Expected ')'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:543:47: Expected ')'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:427:33: Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int'
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:597:28: Implicit declaration of function 'OPENSSL_hexchar2int' is invalid in C99
/Users/maggie/Documents/aes/openssl-master/apps/enc.c:582:9: Implicit conversion loses integer precision: 'unsigned long' to 'int'
Source code of enc.c is here
Does anyone ever encounter this problem?
Thanks.

Visual Studio 2013 - C++ Errors

Some strange things happen. When I compile my program in Dev-C++ it gives me no errors and compiles clean. When I put it in Visual Studio I got a LOT of errors:
Error 1 error C2371: 'MailRecipient' : redefinition; different basic types
Error 2 error C3861: 'GetModuleFileName': identifier not found
Error 3 error C2664: 'HRESULT SHGetFolderPathW(HWND,int,HANDLE,DWORD,LPWSTR)' : cannot convert argument 5 from 'char [260]' to 'LPWSTR'
Error 4 error C3861: 'CopyFile': identifier not found
Error 5 error C2664: 'BOOL SetFileAttributesW(LPCWSTR,DWORD)' : cannot convert argument 1 from 'char [512]' to 'LPCWSTR'
Error 6 error C2664: 'HRESULT SHGetFolderPathW(HWND,int,HANDLE,DWORD,LPWSTR)' : cannot convert argument 5 from 'char [260]' to 'LPWSTR'
Error 7 error C2664: 'BOOL SetFileAttributesW(LPCWSTR,DWORD)' : cannot convert argument 1 from 'char []' to 'LPCWSTR'
Error 8 error C2664: 'LSTATUS RegOpenKeyExW(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY)' : cannot convert argument 2 from 'const char [46]' to 'LPCWSTR'
Error 9 error C2664: 'HRESULT SHGetFolderPathW(HWND,int,HANDLE,DWORD,LPWSTR)' : cannot convert argument 5 from 'char [260]' to 'LPWSTR'
Error 10 error C2664: 'LSTATUS RegSetValueExW(HKEY,LPCWSTR,DWORD,DWORD,const BYTE *,DWORD)' : cannot convert argument 2 from 'const char [9]' to 'LPCWSTR'
It all works on Dev-C++ tho. I need to compile it in VS because I want to add something from the POCO library, which, ironically, doesn't compile in Dev-C++... Any help?
A Visual Studio project defines UNICODE by default.
You can either turn off Unicode in the project settings, or rework your program to use wchar_t based strings (e.g. L"Blah" instead of "Blah").
Or, you can #undef UNICODE before including <windows.h>, every place.
There seem to be some issues about #include statements in your Project. You need to figure out why MailRecipient gets redefined. You will probably have to adjust some of the project settings in Visual Studio. Also, as the first answer suggests Visual Studio uses UNICODE by default, which causes it to call the wide string versions of Windows API functions. You can use the std::widen function to convert your strings just for Windows API calls. For more information on this topic see utf8everywhere.org.

Writing wrappers for Python 3 vs Python 2

In Python, is there any difference in how one would write Python wrappers for c++ libraries if one aims to make it compatible with Py3 vs Py2?
Or should a wrapper originally written for Py2 work the same way for Py3 and visa versa? As I understand it, Python wrappers are written in c++ in a .cxx file which then have to be compiled.
Details
I ask because I'm wanting to install Aggdraw (wrapper for c++ Anti Grain Geometry drawing library), which works in Python 2.6-7, but results in errors on Python 3.4 (Windows 7 32-bit, via "PATH=C:/Python27[or Python34]" and "python setup.py install" in the command line). My hope is to revive this amazing wrapper module for Python 3, and was hoping anyone else here would be interesting in helping out.
I can get it compiled on Python 2.6 and 2.7 without any problems, and I have both Visual C++ 2008 and 2010 so it's not a compiler problem. The problem seems to be in the actual .cxx wrapper code.
Could it be that the Aggdraw wrapper was only written with Python 2x in mind (almost 10 years ago now), and so it didn't take into account problems that might arise in Python 3x? My best guess is that the wrapper fails to convert certain c++ objects/types over to Python due to deprecated and changed features in version 3.4.
I might be willing to go through the .cxx wrapper code to change the necessary parts, if someone can help me identify what the troubleparts are (see command line error codes below)? If we get it fixed then I'll update this post with a link to the "revived" wrapper code.
If there should´t be a difference between Python 2 and 3 wrappers, any idea why I´m getting the error codes below in Py3 but not Py2?
Thanks!
Original wrapper code: click here
C:\Users\BIGKIMO\Desktop\aggdraw-master>python setup.py build
=== freetype not available (edit setup.py to enable)
running install
running build
running build_ext
building 'aggdraw' extension
C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /
W3 /GS- /DNDEBUG -Iagg2/include -IC:\Python34\include -IC:\Python34\include /Tpa
ggdraw.cxx /Fobuild\temp.win32-3.4\Release\aggdraw.obj
aggdraw.cxx
aggdraw.cxx(124) : error C2440: 'initializing' : cannot convert from 'const char
[5]' to 'Py_ssize_t'
There is no context in which this conversion is possible
aggdraw.cxx(126) : error C2440: 'initializing' : cannot convert from 'destructor
' to 'printfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(128) : error C2440: 'initializing' : cannot convert from 'getattrfun
c' to 'setattrfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(142) : error C2440: 'initializing' : cannot convert from 'const char
[4]' to 'Py_ssize_t'
There is no context in which this conversion is possible
aggdraw.cxx(144) : error C2440: 'initializing' : cannot convert from 'destructor
' to 'printfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(161) : error C2440: 'initializing' : cannot convert from 'const char
[6]' to 'Py_ssize_t'
There is no context in which this conversion is possible
aggdraw.cxx(163) : error C2440: 'initializing' : cannot convert from 'destructor
' to 'printfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(187) : error C2440: 'initializing' : cannot convert from 'const char
[5]' to 'Py_ssize_t'
There is no context in which this conversion is possible
aggdraw.cxx(189) : error C2440: 'initializing' : cannot convert from 'destructor
' to 'printfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(191) : error C2440: 'initializing' : cannot convert from 'getattrfun
c' to 'setattrfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(207) : error C2440: 'initializing' : cannot convert from 'const char
[5]' to 'Py_ssize_t'
There is no context in which this conversion is possible
aggdraw.cxx(209) : error C2440: 'initializing' : cannot convert from 'destructor
' to 'printfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(211) : error C2440: 'initializing' : cannot convert from 'getattrfun
c' to 'setattrfunc'
This conversion requires a reinterpret_cast, a C-style cast or function-
style cast
aggdraw.cxx(488) : error C3861: 'PyString_Check': identifier not found
aggdraw.cxx(489) : error C3861: 'PyString_AS_STRING': identifier not found
aggdraw.cxx(575) : error C3861: 'PyString_Check': identifier not found
aggdraw.cxx(583) : error C3861: 'PyString_AS_STRING': identifier not found
aggdraw.cxx(584) : error C3861: 'PyString_GET_SIZE': identifier not found
aggdraw.cxx(730) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(730) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(731) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(731) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(735) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(735) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(736) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(736) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(742) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(742) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(745) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(745) : error C3861: 'PyInt_AS_LONG': identifier not found
aggdraw.cxx(759) : error C3861: 'PyInt_Check': identifier not found
aggdraw.cxx(760) : error C3861: 'PyInt_AsLong': identifier not found
aggdraw.cxx(763) : error C3861: 'PyString_Check': identifier not found
aggdraw.cxx(765) : error C3861: 'PyString_AS_STRING': identifier not found
aggdraw.cxx(788) : error C3861: 'PyString_Check': identifier not found
aggdraw.cxx(789) : error C3861: 'PyString_AS_STRING': identifier not found
aggdraw.cxx(1157) : error C3861: 'PyString_FromStringAndSize': identifier not fo
und
aggdraw.cxx(1289) : error C3861: 'PyString_FromString': identifier not found
aggdraw.cxx(1294) : error C3861: 'Py_FindMethod': identifier not found
aggdraw.cxx(1482) : error C3861: 'Py_FindMethod': identifier not found
aggdraw.cxx(1890) : error C3861: 'Py_FindMethod': identifier not found
aggdraw.cxx(1910) : error C3646: 'initaggdraw' : unknown override specifier
aggdraw.cxx(1911) : error C2091: function returns function
aggdraw.cxx(1911) : error C4430: missing type specifier - int assumed. Note: C++
does not support default-int
aggdraw.cxx(1912) : error C2039: 'ob_type' : is not a member of '_typeobject'
c:\python34\include\object.h(334) : see declaration of '_typeobject'
aggdraw.cxx(1912) : error C2039: 'ob_type' : is not a member of '_typeobject'
c:\python34\include\object.h(334) : see declaration of '_typeobject'
aggdraw.cxx(1913) : error C2039: 'ob_type' : is not a member of '_typeobject'
c:\python34\include\object.h(334) : see declaration of '_typeobject'
aggdraw.cxx(1913) : error C2039: 'ob_type' : is not a member of '_typeobject'
c:\python34\include\object.h(334) : see declaration of '_typeobject'
aggdraw.cxx(1913) : error C2039: 'ob_type' : is not a member of '_typeobject'
c:\python34\include\object.h(334) : see declaration of '_typeobject'
aggdraw.cxx(1915) : error C3861: 'Py_InitModule': identifier not found
aggdraw.cxx(1940) : warning C4508: 'DL_EXPORT' : function should return a value;
'void' return type assumed
The Python FFI library (ctype) has changes between each version of python. It would be up to you to go through the change list and see what exactly is different and why it isn't working.
For example, ssizet and strings are different between the two Python versions.
https://docs.python.org/3/whatsnew/3.2.html#ctypes
Differences in ctypes between Python 2 and 3
In the interest of expanding upon the previous answer, there are many functions which acted upon string in Py2.7 and now act upon bytes or unicode in Py3. Similarly, what referred to int may now refer to long. As just one example of this that caused a problem here, PyString_Check has been deprecated by pyBytes_Check. Read the following for more details:
https://docs.python.org/3/howto/cporting.html?highlight=pystring