Setting up C++ and MinGW in VS Code: 16 bit Unsupported? - c++

I'm trying to follow this: https://code.visualstudio.com/docs/languages/cpp but when I try to run a program I get this error for an unsupported 16 bit application. I found an older question on here from previous versions of the compiler, but what they had didn't quite work for me. The error message is below.
"This version of C:\Users\jvgro\OneDrive\CProjects\main.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher."
I was using the command g++ main.cpp and then running the main.exe file generated. Not quite sure what to do and thanks in advance for the help!

Related

First time using SFML-2.5.1 in NetBeans IDE 8.2 I ran into the problem

After the setup I've done in the properties of the project: at C++Compiler and Linker in both Release and Debug configurations I tried to build the project, which went successful.
Then I decided to run it and had some difficulties: using External Terminal, that did absolutely nothing, Standard output, that showed some text related to dll files I've clue about, Internal Terminal, that showed the very same text.
After that didn't work I went for cmd execution and what I saw was this.
Could you explain what that means and what I'm supposed to do. I'm new to all that kind of stuff, so I apologise if I did something stupid.
Cheers
EDIT: If not seen, I'm using Windows 10 and the version of SFML is GCC 7.3.0 MinGW (DW2) - 32-bit

GDB error: Selected architecture i386 is not compatible with reported target architecture i386:x86-64

Does anyone know what this error means?
I'm working with Netbeans 8.0, gdb 7.8.1 on Linux Machine. Everything was good until two days ago, then I suddenly started to get this error when i'm starting t debug and I have no clue what it means.
So far, I'm trying to clean and reset everything I could think about: reinstall netbeans, clean all local files, rebase my code again, unset all breakpoints and so on and so on.
Could anyone please help me to understand what this error means? I've never set those breakpoints, where does Netbeans take themfrom?
Thanks in advance,
Rachel
EDIT
So now I have a bit more details:
When I'm trying to debug my app directly with GDB, without netbeans I'm getting the following error:
Starting program: ....
warning: Selected architecture i386 is not compatible with reported target architecture i386:x86-64
warning: Architecture rejected target-supplied description
Warning:
Cannot insert breakpoint -1.
Temporarily disabling shared library breakpoints:
breakpoint #-1
Cannot insert breakpoint 1.
Cannot access memory at address 0x8081527
how can I figure out what code\flag in compilation makes my app to be i386? how can I force it to be x86_64?
Thanks again.
OK, the gdb installation on my machine was screwed.
There's no chance anyone could imagine it. I moved to another machine and everything is good now.
This error could appear when you try to use WSL gdb on non-WSL app.
I think you updated the system and the latest version of the glib is not supporting 32bit applications.
Can you do a find to find out which files in all the bin and lib directories on your system were changed within the last 2 days? If it used to support it, but the upgraded version doesn't, then the application which was (probably without your knowledge) compiled to be 32-bit will not be a valid target for all the standard tools on the box.
You specify the target architecture with -m32 or -m64. See if you can specify it explicitly if you are compiling and debugging on different machines.

Installation wxWidgets with mingw64

I try to get wxWidgets installed on a Windows7 x64 Machine but wxWidgets Installation doesn't even work, I cannot get a Hello World App running.
I found out there are several ways to get the library installed and I tried some of them (with Cygwin and the included mingw64 compiler, with mingw64 using diffrent settings), all the time I get Errors while building the library. Could somebody point me out what's wrong with my current setup (which was also my first try) or show another solution?
First I installed mingw64 with the online installer to c:/mingw64. I tried some different setups concerning Version and Threads, but ended up with 4.9.2, x86_64, posix Threads, sjlj Exceptions.
Then I downloaded MYSYS from sourceforge.net and extracted it to C:/mysys.
Then I created a folder C:/wxWidgets and mounted it as /wxWidgets, downloaded the wxWidgets 3.0.2 source and put in into my mysys-home folder.
From /wxWidgets I executed: /home/Martin/wxWidgets-3.0.2/configure --host=x86_64-w64-mingw32 --disable-shared --enable-monolithic
The configure did his job without errors though some libraries couldn't be found and built-in libraries were taken instead (jpeg, png, regex, tiff, expat).
Then I executed make and it ran for some minutes and suddenly crashed. The only output was make: *** [monolib_any.o] Error 1
The last executed command was /wxWidgets/bk-make-pch ./.pch/wxprec_monolib -D__WXMSW__ ...
Right before, there is an note concerning POSIX paths: "CYGWIN environment variable option "nodosfilewarning" turns off this warning...
All the other tries ended up like this one, make suddenly hung up. Any help appreciated.
If the make/compile process really dies without any other error messages, the most likely explanations are that either it runs out of memory (but even then normally there would be some error message) or some hardware problem, it's really not supposed to do this on a working machine.
So my advice would be to run some hardware diagnostics. If this shows nothing, run make -n and execute the command used to compile any.cpp by hand by copy and pasting it.

I cannot build and run a simple Qt 5 application,

I downloaded and installed Qt 5 on Windows 7.
I opened QtCreator 2.6.1 and created a new simple GUI application.
When I try to run it, it says:
“C:\Qt\Qt5.0.0\5.0.0\msvc2010\include\QtCore\qglobal.h:46: error:
C1083: Cannot open include file: ‘stddef.h’: No such file or
directory”
What is the problem and how do I solve it?
My compiler is: MSVC2010 32 bit
A google search yielded the following:
http://qt-project.org/forums/viewthread/10255
This thread notes that this error happens when you don't have the Microsoft Platform SDK installed and you are using Visual Studio. That would make sense considering that stddef.h is one of the standard headers (usually its included using <cstddef>, but looking at the source for qtcore/global.h it would seem that it is indeed included as <stddef.h>). So, try installing the platform SDK if it isn't already there.
If you already do have the sdk, perhaps it isn't configured properly. This answer says you need to follow the instructions given by microsoft here to do command line builds properly. I think Qt Creator probably executes the compiler from the command line, so that may help.
If that still doesn't work, try installing the MinGW compiler and using that. I have seen a few references saying that its easier to compile for Qt under windows using MinGW.

Link error using Cygwin toolchain

I need to use Cygwin to compile C++ code for an Android project. I'm having trouble compiling even a basic "hello world" program. The console gives me this message:
/usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: unrecognized -a option `ware'
I've googled the error and the only result I've found was an issue with one of the programs (I think it was binutils) being out of date, and was resolved when that program was updated. I downloaded the entirety of the Cygwin package at once, so I don't think that's the problem. The compiler and linker aren't communicating properly. How do I fix it without changing compilers?
I figured it out - Android doesn't support the standard C++ library. Fixed by downloading http://www.crystax.net/android/ndk-r4.php
Which basically reimplements that for Android.