Build QT5 project on Ubuntu for Windows - c++

I tried to build qt project on Ubuntu for windows, following the steps in this post
Building Qt 5 on Linux, for Windows
Everything is good except when I run make command, it complains about "i686-w64-mingw32.static-g++: Command not found". But I did see i686-w64-mingw32.static-g++ under /root/mxe/usr/bin. I have no idea what happen. Do I miss something?

You can try run the command directly in shell. If it goes wrong again, check the PATH.

Related

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

GDB on NetBeans 8.2 not starting (Windows)

I've successfully installed NetBeans 8.2 on my system. I've also installed MinGW and MSYS to make it compile C/C++ projects and it works flawlessly. The problem is that whenever I try to debug a program it gives me two errors:
Selected console type is not supported in your configuration, using
External terminal instead
and
GDB has unexpectedly stopped with return -1.073.741.701
and GDB is stuck loading until i press Cancel.
I noticed that if I go to C:\MinGW\bin\gdb.exe it says that the application cannot be started (Error code: 0xc00007b).
Maybe that's because I followed the official tutorial for installing MinGW and MSYS, but I wasn't able to install GDB correctly because point 15 says:
Unzip the gdb-7.0-2-mingw32-bin.tar.gz to your C:\MinGW directory so
that the gdb executable is installed into your C:\MinGW\bin directory.
but if I unzip the files, there are bin and share directories (which overlap with the existing ones), so I chose to cancel.
I could have found the issue, but I'm not sure. I ran Dependency Walker on gdb.exe and it reds out ZLIB1.DLL and KERNEL32.DLL. Do I need the 32-bit version of them? If so, where can I find the downloads?
Screenshot:
Not unzipping the files is almost definitely the problem. There is probably a dependency that doesn't, causing a runtime error.
Problem solved: as I mentioned in my edit, the problem was the 64-bit version of ZLIB1.dll, so I downloaded the 32-bit version and put it inside C:\MinGW\bin. Now everything works perfectly. Thanks to #bremen_matt for suggesting me that it was a dependency issue.

Ubuntu 14.04 LTS x86-64bit Qt Creator 3.0.1 Kit Qt 4.8.6 Failed to start program. Path or Permissions Wrong?

I am trying to run a program in Qt Creator version 3.0.1, compiled on a 64-bit version of Ubuntu 14.04 using Qt 4.8.6. I have searched through other posts relating to the topic, and odds are that there's a conflict between 32-bit and 64-bit executable files. However, what is surprising to me is that the program was running just fine with no problems on the exact same environment two hours ago.
The error being returned is:
Failed to start program. Path or permissions wrong?
Again, I know that there might be a problem with the 32-bit and 64-bit stuff. I checked the executable with ldd and I got:
not a dynamic executable
This says to me that the executable cannot be run. But I still don't know why, because as I said, I was running the program two hours ago and it was working fine.
In fact I am fairly sure now that it is one of the following:
Try (where program is the name of your executable):
In a terminal cd /path/to/your/executable. Then `./program'
If that does not work do sudo chmod 777 program and try again.
If / when you get this running in a terminal try looking in QtCreator build path under Projects --> General --> Build Directory and check this path is correct.
In QtCreator check the Run Settings --> Working Directory
It could be that you are running Qt as your normal user when before you where running as admin (or visa versa) and so either your paths have changed or the permissions are different.
I had a look around the web and found similar issues as well, this looks the same to me and I do recall something like this when running as admin once...

What do I have to do to set C++ development in eclipse?

I am currently trying to set my eclipse so that I can start c++ development on my Windows computer. However, I am stuck with some errors. But first, here is what I did so far:
Installed the CDT for Eclipse
Installed Cygwin (with the additional packages gcc, gcc and make)
Added all "paths for headers" in Eclipse
The problem is that when I try to run my Hello World program, I get Launch failed. Binary not found.
I already build and rebuild the project but the program is still not running. It must be because of these errors that I have:
/bin/sh: g++: command not found
make: ***[src/HelloWorld.o] Error 127
What can I do to solve these errors?
Try running the Cygwin setup.exe again and select the packages for g++. Search for that and make sure those are installed. It should be under the name gcc-g++. The C++ compiler is installed separately from the C compiler.
Ok, I figured it out by myself. Since this really freaked me out, I want anyone else who has this problem to know how I solved it.
So apparently, since I had g++, gcc and all that installed, it had to be a problem with the path.
So what I did was check my path. If you don't know how to edit it, check this link http://www.computerhope.com/issues/ch000549.htm
So in there, I chose Path under the System variables and clicked on Edit.... What I noticed was that instead of C:\cygwin64 it said C:\cygwin. All I did was append the 64 (since I had installed the 64-bit version of cygwin) and I was done.
I restarted Eclipse, cleaned and built the project and the errors where gone!

Using Eclipse CDT under Windows with Cygwin

I am trying to use Eclipse CDT with Cygwin, but I have problems with the debugger. I have done the following:
- installed Eclipse CDT
- installed Cygwin with gcc, g++ make and gdb
- added c:\cygwin\bin to PATH
- created a new Hello World application in Eclipse
Compiling went well from Eclipse. The first problem was that I had to set the executable manually in the run configuration. Having done this, I running also worked. But when I try to debug, I get the following error:
When I switch to debug perspective, I can see the following:
I tried different debug configurations, but I always get the same result.
First, make sure gdb is located on c:\cygwin\bin. I believe executing which gdb on cygwin might help you do that.
Now, instead of adding this information to PATH and making it available to all your Windows applications, try adding it to your project settings inside Eclipse, like this guy did:
http://www.benjaminarai.com/benjamin_arai/index.php?display=/eclipsecygwingcc.php