SFML 2.1 Code::Blocks Static linking not working, - c++

I am new to the idea of linking libraries in c++, and am trying to get SFML to work with C++. I am on Windows 7 64-bit and am using Code Blocks. I have downloaded the 32-bit mingw GCC SFML DW2 version of SFML. I followed this tutorial: http://www.sfml-dev.org/tutorials/2.0/start-cb.php to set up code blocks. I am staticly linking the libraries. When I press the "Build" button, I get whole host of errors, with undefined reference to '__Unwind_Resume' and '__gxx_personality_v0'. I have looked up this issue, and have only found command line fixes, using g++ instead of gcc. I cannot do this within the codeblocks UI. Can someone give me a hand?

The version of the compiler shipped with code::blocks is the 32-bit 4.7 TDM-SJLJ one, so you need the version of SFML compiled with the same compiler (GCC 4.7 TDM (SJLJ) - 32 bits)
If you want to use the 64-bit version of the library you need to install the 64-bit version of the compiler, available here

change the linker program in settings->compiler->toolchains to g++.exe or mingw-g++.exe

Related

where and how do i get gcc g++ 7.3.0

I would like to use SFML but at first place i need to get the same version of SFML and dev c++ compiler. It was easy to get the SFML 7.3.0 version, but i can't find the 7.3.0 version of compiler, even the MinGW installation manager doesn't have it, but i need it. I've tried searching the internet, but i found nothing that could possibly help me. The only way for me to use SFML, is using 4.9.2 version of compiler and SFML for now, but it's old and have a lot of bugs/oversights. So if u use SFML 7.3.0 or know how to get and use it, pls tell me how to.
I don't follow your statement that you need the MinGW GCC 7.3.0 compiler to build SFML 7.3.0.
When looking at SFML (https://www.sfml-dev.org/download.php) the latest version seems to be 2.5.1.
That version builds perfectly well with more recent versions of MinGW/MinGW-w64.In fact even the latest GCC 11.2.0 can build it - I used the 64-bit standalone build from https://winlibs.com/ to try this.
GCC 7.3.0 is several years old. There is usually no reason to use very old GCC versions. Instead you can tell GCC to use an older standard of the C language with the -std= flag (e.g. -std=c89).

Using SFML for Codeblocks C++ appears ERROR library SFML

I have a problem when I tried to install SFML on Codeblocks. Well, first I install codeblocks: codeblocks-20.03mingw-setup.exe . That's compile correctly after that I download SFML 2.5.1: GCC 5.1.0 TDM (SJLJ) - Code::Blocks - 32-bit.
Following, I extract the SFML file.The problem comes I COPY THE CONTENT OF "BIN" INSIDE OF MY CODEBLOCKS PROJECT. A video helps me to do all of before, I WROTE ALL THE LIBRARIES: GRAPHICS, WINDOW, NETWORK, AUDIO, SYSTEM BUT NOTHING. I show you the error:
cannot find -lsfml-audio-d-2
And continue with network, window,system, graphics
At the ends:
error: ld returned 1 exit status
what's wrong? help me please. I have to make a video game using CODEBLOCKS as soon as I fixed this problem. I'll so thankful for your answers.
On the SFML download website (https://www.sfml-dev.org/download/sfml/2.5.1/), it says:
The compiler versions have to match 100%!
The CodeBlocks 20.03 MinGW installation includes version 8.1.0 of the GCC compiler (as is stated on the download page: http://www.codeblocks.org/downloads/26).
Your downloaded version of SFML thus is only intended to work with version 5.1.0 of GCC, but you have version 8.1.0. This can result in a number of errors.
There are a few possibilities to fix your issue:
You could theoretically compile SFML yourself with your specific compiler, but this option may be quite complicated.
You could use a compiler with the matching version. On the SFML download website, there are some links to the needed compilers. After having installed a compiler, you will have to configure CodeBlocks to detect the new compiler on your system (reference: Adding compiler to code::blocks). Now, in order to add SFML to your project, I would suggest to use this official guide:
https://www.sfml-dev.org/tutorials/2.5/start-cb.php
You could use an environment like MSYS2 (which I use personally) to have a package manager to manage your compiler and libraries installations. This way, your compiler installation and your libraries should work with each other. But in order to use this compiler in CodeBlocks, CodeBlocks would have to be configured.
I would suggest that you refer to option 2 because it probably is the quickest solution.
Feel free to ask if you have any more questions. I know from personal experience that setting up SFML (or any other C++ library) to work with your IDE may be quite tricky.

ld exe in MINGW can not find library

I am trying to build C++ code using MINGW 64 bit 4.8.0 and MSYS2.
I am using Windows 7 x64 with Netbeans 8.2 IDE.
I am getting below error while building the code
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lldscripts
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l6to4svcl
I search the entire MSYS/MINGW folder for these two library but I did not find any, is there any toolchain that need to be installed for this?
There is something wrong with Netbeans, I switch to codeblocks and same code works.

QT enable cross-compiling using MinGW (precompiled)

Good day all
I have been searching for a method of cross-compiling for QT-Creator in Linux for sometime now, and I have been having alot of trouble with it.
Background info
please note: I am on a Linux machine, and would like to cross compile Windows Apps
My system:
Ubuntu Gnome 16.10
QT Creator 4.0.2 (based on QT 5.7)
I have came across a few SO links, a few blogs with broken instructions, etc and one seeming helpful but dependencies could not be found.
I have also attempted another compiler MXE and cloned and attempted to build the MXE compiler from the GIT repo, which failed (no solution for the build error - VTK build error)
I decided to download precompiled MinGW compilers (i686 and x86_x64 versions) from sourceforge
Issue:
In QT Creator, adding the compiler is done without an issue, adding the "Kit" and selecting the newly added compiler, an red exclamation gives an error
The Compiler (x86_windows_msys_pe_64bit) cannot produce code for QT version 5.7.0 GCC 64Bit (x86_linux_generic_elf_64bit)
This occurs for both 32 + 64 bit compilers.
I think that you should have a QT version that matches your compiler ABI. The error tells you that the MinGW compiler doesn't match the Linux version of QT you have used. Therefore, get a windows version of QT and use it instead (just as you've added WinGW).
You can download Qt Binaries from here.

Boost Binaries for MinGW

Are there precompiled Boost binaries for MinGW? I've tried compiling them on my own and I've encountered way too much difficulty, and at this point I'm pretty sure I've broken something vital to Windows and I'm going to figure out what two months down the road. So does anybody know where I can get a precompiled boost library to use? If not, I think I'll just wait until std::thread becomes available on MinGW.
Fedora Linux 16 have them, but compiled with GCC 4.6 (C++ libraries aren't compatible between major compiler versions, Fedora 13 had Boost for GCC 4.4, Fedora 15 has for GCC4.5):
DLLs for: GCC 4.6 GCC 4.5 GCC 4.4
Static for: GCC 4.6 GCC 4.5 GCC 4.4
A free (as in freedom) program — 7-zip — can open this RPM packages on Windows.
It is much easier to cross compile for Windows with MinGW32 on Fedora than to compile with MinGW+MSYS on Windows. Often it is as easy as ./configure --host=i686-pc-mingw32 && make if you have mingw32-* packages installed with distribution's package manager.
A list of available packages for Fedora is here — search for mingw32. There are compiled C and/or C++ libraries for technologies like SDL, Curl, GTK+ with Glib and Glade, Iconv, JPEG, Ogg-Vorbis, SQLite, ZIP, SSL, PCRE, Qt, Readline, Zlib and many more.
It seems a lot of folks have issues with MinGW and Windows when it comes to Boost. I found a great 'how-to' that helped me setup the Eclipse CDT with MinGW and Boost. Worked like a charm, no issues!
How to setup MinGW, Eclipse CDT and Boost
Hope that helps. It covers both Cygwin and MinGW. I used MinGW and now I am making cross platform code in Eclipse. I am also using QMake from the Qt libraries to manage my Makefiles across the multiple platforms. Talk about comfort!
Last week I had a need for the Boost libraries in MinGW. I couldn't find any binaries, but after some very painful debugging I managed to get them compiled myself. I eventually scrapped them and switched to Visual Studio, but I was able to pull the binaries out of my recycling bin for you (compiled with GCC 4.6 I believe):
http://daxnitro.com/mingw.zip
Hopefully they'll be useful to you.