sigc++ error during GTKmm cross-compilation - compilation

I wrote simple GTKmm program from here and try to cross-compile it for windows using mingw cross-compiler, but it fails. My output is here.
When I compile simple program using just GTK gtk.h header it works perfectly - compiles (using the same command) and run on Windows.
I am running Fedora LXDE spin and using GTKmm-2.4 (from win).
Everything else works fine - I can comile for UNIX GTK and GTKmm but for Win just GTK. I have my PKG_CONFIG_LIBDIR set properly (one for UNIX and one for Win)
Thanks for any advice - I also tried to install new libsigc++ from Yum Extender but nothing.

Fedora includes a number of MinGW cross compiled libraries, including gtkmm 2.4 and libsigc++. I see you are using gtkmm installed in /home/michal/Dropbox/GTK/GTKmm-Devel/; have you tried using the system packages?
To install the binary packages: 'yum install mingw32-gtkmm24'
... and then to compile the hello world sample, run:
i686-pc-mingw32-g++ helloworld.cc main.cc -o helloworld.exe `i686-pc-mingw32-pkg-config gtkmm-2.4 --cflags --libs`
Also, the Fedora MinGW project has a mailing list and an IRC channel where people can help get you started.

Related

GCC/G++-11 on windows

Hey I'm trying to compile a program that requires GCC and g++ 11. I've tried msys2 but it only goes up to GCC 10.04
And some of my libraries are supposed to be built on a mingw like environment. So is there any other way of running that program on a windows machine?
Get the latest MinGW-w64 GCC build from https://winlibs.com/

How to Compile Ncurses Program for Native Windows Use

I'm trying to compile a C program using Ncurses on Windows. I compiled it successfully using GCC and it works perfectly if I run it in Cygwin or MSYS2. However, if I try to run it in the Windows Command Prompt, I get this error:
Error opening terminal: xterm-256color.
Is it possible to compile it to run using the native Windows console? This is how I've been compiling it:
gcc -o PROGRAMNAME main.c -lncurses
I also have the Cygwin and Msys dlls for Ncurses copied into the directory of the compiled executable.
Update
So I figured out how to get the program to run. I deleted all the DLLs from the project folder and then added "C:\msys64\usr\bin" to my PATH environment variable. However, I would still like to know if there's a way to get this to work if I were to distribute it, since it's still relying on my installation of MSYS2.
Update 2
Gave up and just used pdcurses and it works fine.
Update 3
Nevermind, found a solution! See below.
I figured out a solution. I'll post it here in case anyone else has this same issue. Thanks to Thomas Dickey for your help!
Install the mingw-w64 toolchain and any other packages you need to compile your project (this is mostly where I messed up)
Make sure to include the /mingw64/include/ncurses directory when compiling, or else gcc won't be able to find curses.h
Include /mingw64/bin as a static directory or copy over the necessary dlls to the same folder as the directory
I ended up with this to compile:
gcc -I/mingw64/include/ncurses -o PROGRAMNAME main.c -lncurses -L/mingw64/bin -static

I installed Nim without any problem, but it gives me this error, what should I do?

I install Nim Lang but it not works. I get this errors, how can i fix? (I have completed the setup.)
Error: invocation of external compiler program failed. Sistem belirtilen dosayayi bulamiyor.
Additional info: "Requested command not found: \'gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -I\"C:\\Program Files\\Nim Language\\lib\" -IC:\\Users\\SyTax\\Desktop -o C:\\Users\\Sytax\Desktop -o C:\\Users\\SyTax\\nimcache\\name_d\\stdlib_io.nim.c.o C:\\Users\\SyTax\\nimcache\\name_d\\stdlib_io.nim.c\'. OS error:" 2
Error;
enter image description here
Probably you only installed the first package from Nim's windows installation page. Note that there are other dependencies mentioned on that page. You may also need:
MingW compiler dependency, installed with finish.exe.
DLLs available on your system, like PCRE or OpenSSL, also available for download.
Alternatively you could try installing Nim using Scoop, which seems to be able to install both Nim and the required compiler.
The Nim compiler creates C code, so to compile your code to binary and run, you should install a C compiler. The default is GCC. In linux and mac, it comes with the system, so I am assuming you are using windows.
I am not a Windos user, but AFAIK you neet to install mingw amd gcc
http://www.codebind.com/cprogramming/install-mingw-windows-10-gcc/
http://mingw.org/

Cross compile windows 64 bit .exe from linux

I know that if I want to compile a 32 bit .exe for windows on Linux I can just install and use the mingw32 package (e.g. apt-get install mingw32) on linux. What if I want to compile a windows .exe that is 64 bit? Is there tools or a method to do this?
It looks like my answer lies with the Mingw-w64 project which is available for host OSes Linux, Darwin & Windows
I know this question is very old and already has an accepted answer but I will post this answer the way I do it now. It is pretty simple and straightforward and I hope it helps anyone landing here:
To cross-compile windows applications from a Linux machine you just need to install mingw-w64 C and C++ compiler. On debian based system you just do this:
sudo apt install -y gcc-mingw-w64 g++-mingw-w64
That will install the gcc (the c compiler) and g++ (the c++ compiler) for both 64 and 32 bit cross-compilation
After that, if you need a 64-bit application just do:
x86_64-w64-mingw32-g++ hello.c -o hello.exe
And if you need a 32-bit application just do:
i686-w64-mingw32-g++ hello.c -o hello.exe
Simple as that!
It's also possible to install MinGW from MSYS2. The main advantages are:
Usually up-to-date MinGW, regardless of what your Linux distribution ships.
A lot of prebuilt libraries.
Several MinGW flavors are provided: x32 and x64, with different C runtimes, etc.
You can't install MSYS2 on Linux directly, but it's possible with Quasi-MSYS2.
Install Clang (and LLD):
On Ubuntu:
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh
rm llvm.sh
Clang can cross-compile to Windows using MSYS2 libraries. Alternatively, you can run MSYS2 MinGW in Wine, but it's slower.
Install dependencies:
sudo apt install make wget tar zstd gpg wine
Wine is optional.
Install Quasi-MSYS2 and any desired MSYS2 packages:
git clone https://github.com/HolyBlackCat/quasi-msys2
cd quasi-msys2/
# Optionally, choose MSYS2 flavor, see full list at: https://www.msys2.org/docs/environments/
# echo MINGW64 >msystem.txt
make install _gcc _gdb
Then:
env/shell.sh opens a shell with the correct environment variables set up.
win-clang++ hello.cpp invokes Clang with flags for cross-compilation.
./a.exe runs the resulting app in Wine, if it's installed.
Full disclosure: I'm the developer of quasi-msys2.

g++ produce executable for windows

I am using gcc/g++ to compile c/c++ applications - living on OpenSuSe btw.
Is there any way (some option i guess) so that g++ will produce an executable suitable for windows ?
You can search for a mingw32 package in OpenSuSE (I know there is one for Debian) or install it manually. Then if you have a configure script the command line would be something like this in order to have make use the MinGW cross-compilation toolchain:
./configure --prefix=/usr/local --target=i386-mingw32
mingw.org also has a tutorial on building a cross compiler, don't know if that works.
(As an aside: Some websites point to mirzam.it.vu.nl/mingw containing MinGW RPM packages but it seems like that site is down.)
You'll have to be running g++ on Windows to get a Windows executable out of the other end.
Check out mingw or cygwin.
Check out MinGW Cross and related links:
http://www.nongnu.org/mingw-cross-env/#see-also

Resources