What is different of wxWidgets between when install by MSYS and compile by MinGW? - c++

I am learning GUI programing on Windows, and I choose wxWidgets, Eclipse, MinGW for my learning. I can compile wxWidgets with command:
mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1
And I found that I can install it by MSYS by command
cd /mingw/wxWidgets-2.8.10
./configure –prefix=/mingw –disable-shared
make && make install
What must I do to integrate wxWidgets with Eclipse? Do I compile it by MinGW or install it by MSYS and How can I set up it for Eclipse Neon?
`

From your standpoint there is no difference.
It is better to compile the library with MinGW and do a DEBUG build since you will do development and a lot of times this will help a lot.
Now in order to set it up with Eclipse:
After you build is finished, open up Eclipse.
Create a project (C++) or open an existing one.
Open the dialog for project properties and find where it asks you to set the "include/header search path".
Set this to be "/include;/lib/debug/include". The second path is a path to the build_directory/include where setup.h is located.
In the same dialog for project properties find where it asks for a library search path.
There enter "main_wx_folder/lib".
Somewhere in that same page of this dialog find where it referencing the actual libraries. Add "-lwx_base... -lwx_core...". Check the actual file names inside the lib/ folder. Should be something like libwx_*.
Compile the project.
Keep in mind though that Eclipse is not "officially supported" IDE, meaning that there is no project for that IDE supplied with the library and there is not too many people use it for C++ development with wx.
The "official supported IDE" for wx are: MSVC, CodeBlocks and (to some extent) CodeLite.
It use to support Borland compiler (and IDE), but unfortunately there was a recent posts on the forum that recent version of Embarcadero broke the build of the library. This compiler is still supported though.
Good luck! If you have any issues don't hesitate to update the question with any possible errors.

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).

How to install wxwidgets on Eclipse Mars.2 Mac?

I want to start doing some c++ but need it to be cross platform. I have found wxWidgets as a GUI solution and will use some of their SQL solutions for my program.
I tried searching the internet for how to install wxwidgets on Eclipse Mac but no luck. Haven't found anything that I can wrap my head around it.
wxWidgets is a C++ cross-platform and cross-compiler solution. It means that you don't need to install it. You can just compile it and use it to develop a software.
In order to compile this library, you should have a C/C++ compiler (clang or gcc on OSX/Mac) and their toolchain. Also if you plan to develop for OSX, you shuold have an OSX/Cocoa SDK installed (it is installed automatically with Xcode, have no idea about Eclipse).
In order to do so, you should:
Install C/C++ compiler (either with Xcode or Eclipse or any other IDE you have available).
Download latest wxWidgets release and unpack to you home diectory.
Open up a Terminal and issue following commands:
a. cd ~/wxWidgets
b. mkdir buildMac
c. cd buildMac
d. ../configure --enable-debug --with-cocoa --with-mac-osx-version-min=10.7 && make
e. ./wx-config --cxxflags
f. ./wx-config --libs
Open up Eclipse and start a new C++ project. If you are on OSX you may choose C++ bundle application.
Open the project properties and copy the results of the commands 3e and 3f to the project properties where appropriate. Consult with Eclipse manual/ML/forum to understand where to put that info.
Copy the file ~/wxWidgets/samples/minimal/minimal.cpp to you project directory and add this file to you project. Compile and run the project.
If you get stuck with any of the above instructions or get an error during compilation of either library or your project - don't hesitate to ask either here or open another thread.
Also, you can register on the wxWidgets forum at forums.wxWidets.org and subscribe to the wx-users ML.
Good luck.

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

Qt Creator Compiling Error at step 'make'

I just started using Qt Creator for creating C++ GUI programs. I just downloaded it and installed it, but the compiling process is throwing me errors. When I try to compile my project (very simple, just a QLabel on the screen...it's my first project) it comes up with the error:
qtcreator_ctrlc_stub: Command line failed:
C:\Users\andrew\Dropbox\Programming\C++\build-
FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile 10:04:35:
The process
"C:\Users\andrew\Dropbox\Programming\C++\build-FirstGUIApp-Desktop_Qt_5_1_1_MSVC2012_32bit-Debug\Makefile"
exited with code -1. Error while building/deploying project
FirstGUIApp (kit: Desktop Qt 5.1.1 MSVC2012 32bit) When executing step
'Make'
I hunted around for an answer here and here and a couple other places but I'm just confused about the whole thing. I have a couple of ideas of my own but I don't know how to try my ideas. Here are some of my ideas:
1) MinGW isn't in the path or isn't installed
But, if it isn't in the path, how do I put it in? Where is it? I have Code Blocks installed which has MinGW installed, so could I maybe use it from there?
2) the make file is messed up somehow
Again, what could be wrong and how could I fix it?
3) Qt Creator isn't installed correctly.
Obviously, re-install it, but I want to make sure all other options are tried before, because it took me a very long time to download.
I apologize if I'm sounding noobish or it's a stupid question, but I really am confused with all of this. Please be patient with me and try to explain things well and thoroughly. I'm using Windows 8.1 and downloaded the offline installer. Thanks in advance.
UPDATE
Here is a screenshot of my Qt, how can I tell if it is the visual studio or minGW version?
UPDATE
Here is my MinGW Folder in CodeBlocks. Is this the folder with the compiler or is it something else?
For your ideas:
1: if you downloaded from qtproject with binary. then qt and qt creator should be installed under the C:\Qt\Qt5.1.1 then corresponding minGW should be stay in C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe
this is the directory you need. Remember, QtCreator needs two tools to make sure your project and compile and run, qmake and compiler.
Qmake is tool help you translate .pro file into makefile,
compiler (gcc) minGW use gcc to run the makefile, compile your code to binary.
where to figure out tools you are using are correct?
---> qtcreator --> Tools -> Build&Run -> Kits
in here You should be able find different kits, of course you maybe have only one.
Select one, Double check the Qt Version and Compiler is the one you wish to use.
click Manage next to compiler, Every compiler in the Auto-detect should be ok to use.
If you don't see anyone, add one, click Add, MinGW, put C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\gcc.exe like into path. ABI should auto-set depends on your environment.
Answer to your second question, what's wrong with your makefile, no one knows, you should check your .pro, usually makefile are generated by qmake xx.pro. Double check your .pro file and re-run qmake will solve the problem.
in tools->options->build&run check if minGW is actually there in the compiler and kit list
in the project tab (on the left hand side) you can set the environment for the build click the PATH value and add the path to minGW to it (you may need to add a lib and include var so the standard library gets added)
re run qmake from the build menu
double check you have the correct version it looks like you have the visual studio Qt not the minGW version,
Terminal:(in Linux)
sudo apt-get install build-essential cmake libqt4-dev
i'm sorry i dont know why this code works,but i have the same problem in linux and this code worked.

instructions on building CGAL libraries from source code

I have installed Computational Geometry Algorithms Library 4.3 and followed instructions on CGAL4.3 manual page(http://doc.cgal.org/latest/Manual/installation.html).
After I cmaked CGAL-4.3 folder , it says ,"make # build the CGAL libraries".However I cant find any cmake command or .exe file to execute "make".What am I missing here?
below I copied the instructions on the manual page in case anyone cant access it.
1 Introduction
This document describes how to install CGAL on Windows, Unix-like systems, and MacOS X.
Ideally, setting up CGAL amounts to:
cd CGAL-x.y # go to CGAL directory
cmake . # configure CGAL
make # build the CGAL libraries
You are on windows so you may not have make.
You can either install make or tell Cmake to generate something else than a makefile (like a Visual Studio project for instance).
If you are using Cygwin, it should be pretty easy to install make or maybe you already have it. Try typing make at the Cygwin prompt.
From my limited experience building code on windows, I recommend installing MinGW and Code::Blocks. Then ask Cmake to generate a Code::Blocks project using MinGW. Open the project and build it. Clean and easy.
Note that the CGAL Project provides Installation Instructions for Windows