POCO C++ library is not compiling with CMAke and MinGW. Thread_WIN32.cpp __except error - c++

everyone. I try to build POCO C++ library with CMake and MinGW compiler, but I receive syntax error in POCO Thread_WIN32.cpp file (Picrealted). I think it is somehow related with compiler exact version, posix-sjlj. Has anyone encountered this problem?
Setup:
Windows 10
MinGW-W64 x86_64-posix-sjlj-rev0 8.1.0
CMake 3.26.0-rc1
error pic (link)
UPDATE 1
I tried another version of MinGW-w64 (MinGW-W64 x86_64-posix-seh-rev0 8.1.0), but it also didn't work. I have another question: maybe compiler just makes it's job right? In Thread_WIN32.cpp file from POCO GitHub in setThreadName function no __catch before __except. Why? Mustn't it be there?
pic of setThreadName function from POCO GitHub
UPDATE 2
Okay, after __try shoudn't be __catch, after __try follows __except and that's all. This is microsoft own way to handle errors - SEH. But I wonder hard is there some way to properly use MinGW-w64 compiler with SEH. I read about __try1 and __except1 in MinGW, but Internet said that it might be unsafe and very painful

So, I tried some different variations of MinGW-w64 compiler, but it didn't work. I decided to download MSVC compiler with Microsoft Build Tools and it did pretty well, all libraries compiled

Related

Can I build wxwidgets with clang++?

There are walkthroughs to build wxwidgets with common compilers on windows, such as MSVC or MinGW, but there are no options for clang. I do have the other two compilers, but I dislike using Visual Studio for projects that are not C# or other .NET languages and I just don't like MinGW, nothing specifically. I use clang to compile, and I'd like to build wxwidgets with it, but I don't know if it would error or not, so would it work? I'm using windows, if not already clear. Thanks in advance.
You can definitely build wxGTK and wxMac under Linux and Mac respectively with clang and I think people did build wxMSW under Windows with it too, but it's a less commonly used compiler there, so your best bet would be to just try doing it. If you run into any problems, please free to open tickets on wxTrac, we do want to support clang under this platform as well.

How do I link a library in VSCode?

I'm trying to include curses.h and some functions from that lib (specifically detecting a keyboard hit without stopping), but whenever I try, it gives the error "symbols not found." I'm assuming that this is because the clang++ compiler sees curses.h as a C library. I've gathered I need to link curses.h, but I don't know how and I could not find any real guides.
I'm writing a program in C++ using VSCode and clang++ on a mac. Any help is appreciated.
For anyone else who has this problem- my clang version was outdated. It was installed, so after a brief check, I thought all was good. However, it was not able to compile (nor find some libs for some reason) the newer versions of C++. Installing the latest version of clang fixed all issues.

GLib syntax errors, while compiling libnice with latest GLib for win32

Some necessary background:
Libnice (p2p library) was meant to be compiled using 2.28 Glib (here's win32 compilation readme https://github.com/jcaden/libnice/blob/master/README.win32),
BUT the official example
(this one http://cgit.collabora.com/git/user/kakaroto/libnice.git/plain/examples/sdp-example.c),
implementing compiled before libnice, obviously was written using latest glib stuff.
I assume, it is possible to rewrite example for the older one, but latest glib is more elegant and cool all around, that's why I got a wish to use it.
Now, my question:
While trying to compile Libnice using latest GLib (got it from here http://www.gtk.org/download/win32.php) for win32, using Visual Studio 2010, I encounter some syntax errors (Many of them).
You can see log here https://gist.github.com/anonymous/71e2a80e57eb4b8ae6c1
Is it fixable, and how?
P.S: to use latest GLib, I downloaded same stuff, that was described in readme; i.e Glib dev and runtime and zlib and gettext runtime.

boost asio giving You must add -D__USE_W32_SOCKETS to your compiler options on cygwin

I was trying to use the boost library first time. Using as an environment Eclipse 4.3 with CDT and as compiler gcc 3.4 and boost 1.53.
I was browsing various sites to find info on how to setup boost, but it doesn't seem to work. When I compile trying to include boost/asio.hpp I get the error:
You must add -D__USE_W32_SOCKETS to your compiler options
However, I don't want to use windows sockets, I want to use posix, so I don't really know what is wrong. As I need the project to run on HP-UX later, I dont want to get to Windows specific. If I use now windows sockets will the program later be easily portable to Unix, or are all the details encapsulated in boost, and I don't have to care anyway?
I tested a simple testprogram using FOREACH loop to confirm that boost itself works, and this is the case.
I also found this: https://svn.boost.org/trac/boost/ticket/7881 so does it mean that this problem is currently currently not supported, or am I doing something wrong?
It seems what you're trying to do is not supported by the library, the documentation states the following under supported platforms
The following platforms and compilers have been tested:
Win32 and Win64 using Visual C++ 7.1 and Visual C++ 8.0.
Win32 using MinGW.
Win32 using Cygwin. (__USE_W32_SOCKETS must be defined.)
Linux (2.4 or 2.6 kernels) using g++ 3.3 or later.
Solaris using g++ 3.3 or later.
Mac OS X 10.4 using g++ 3.3 or later.
added emphasis is mine. If that's not possible, you might try the patch suggested in the linked ticket. However, grepping through the source code I see several occurrences of #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) so it's not obvious that simply patching io_service.hpp will resolve anything. You might try adding -U__CYGWIN__ to your CXXFLAGS, though the cygwin toolchain may not like that.
Full disclosure: I am not a Windows guy so hopefully someone else will chime in.
The libboost-devel package in the Cygwin distribution includes patches to not use Winsock on Cygwin in Boost.Asio. I suggest trying that in conjunction with the gcc4 packages, which provide more recent versions of GCC.

How to enable C++ multithreading?

I've been trying multithreaded C++. I installed the new Dev C++ 5.4.1 and added -std=c++11 to the compiler options. Then I added #include <thread> somewhere in my source code, and std::thread mythread (some_func).
When I compile the source file, I get a compiler error "thread defined in this scope".
What do I have to do to have it working?
You have to get the correct package of Mingw like sad here:
http://gameprog.it/articles/90/c-11-getting-started-on-windows
the package is found at:
http://sourceforge.net/projects/mingwbuilds/
The article is about code::blocks, but you can easily setup DevC++ too. Just pay a bit care about file names.
There's no longer need for boost threads at all. (Boost still remain a very good library and I encourage you to take a deeper look, but that is out of topic)
Official build of MinGW (that compiler Dev-C++ uses) has no support for standard library threads now.
You can use boost::thread as a drop in replacement (API is similiar enough) or use Microsoft Visual C++, or try programming with g++ on Linux (this is what I have done recently, using a virtual machine).