wxWidgets + Cygwin on windows - c++

I am trying to install wxWidgets on Windows.
I unzipped wxWidgets and then followed this guide: http://wiki.wxwidgets.org/Adding_an_Environment_Variable_under_Windows
I copied their sample hello world source code and tried to compile it using g++ but it tells me wx/wx.h No such file...
I am new to C++. Am I doing it right? I followed the guide exactly.
PS: I use cygwin + notepad++

With Cygwin you need to:
Build wxWidgets using configure and make, see the appropriate section of docs/msw/install.txt in your wxWidgets installation.
Optionally install it using make install.
Use wx-config --cxxflags --libs when compiling your code, just as under Unix (because Cygwin is Unix).
P.S. If you're new to C++ you're unlikely to find Cygwin the most newbie-friendly environment.

Related

Using GTK+ without MSYS2

Dear programmers and developers,
I really want to try out GTK+ 3 on windows. Therefore, I read the official GTK+ download explanations at https://www.gtk.org/download/windows.php and installed everything with MSYS2.
Now I have a lot of files in my mingw64 subdirectory of my MSYS2 folder.
The question: How do I include all of them right? How do I link to GTK+ with all it's dependencies? I know there is a magic pkg-config attribute for the Linux C/C++ compiler, but unfortunately I am really not interested in compiling my projects in MSYS2. I am willing to use a simple MinGW (64) compiler.
Can anybody help me using the .a's, .h's and .dll'a that MSYS2 generated with a simple MinGW 64bit compiler for a stupid C++ project?
It would make me extremely happy!
Darth Moon
€edit: I actually have downloaded a precompiled GTK+ version from https://www.dropbox.com/sh/8d1qbh5dsp044on/AAB63l5I1eZks-QqjH6HXUJHa. Unfortunately, it is only 32bit but I will soon try to compile the whole GTK+ project on myself like this guy at https://github.com/Wesley-Chan/GTK-for-Windows did.
But if anybody has any idea how to build GTK+ in a smooth way under windows (especially for 64bit), please let me know! I really enjoyed the GTK+ example application and I really want to make my own ones!
I was able to successfully compile a GTK3 program in a MinGW 64-bit shell from MSYS2. First I installed the GTK3 package:
pacman -S $MINGW_PACKAGE_PREFIX-gtk3
Then I compiled the first example program from this page using the following command:
gcc test_gtk.c $(pkg-config gtk+-3.0 --cflags --libs)
Then I ran ./a.exe and it created a window.
If you are getting "undefined reference" linker errors, it means your Makefile is not linking your program to all of the correct libraries, or the order of the inputs to the linker is wrong.

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.

install wx-widgets is driving me insane on Yosemite

I'm on Mac OS X Yosemite 10.10.2. As far as I know, wx-widgets were preinstalled on older versions on OS X (probably that's why google search doesn't help), but that's not the case anymore. I need to get started on a C++ project using wx-widgets, using any IDE (Eclipse, Codelite, or whatever is best). However, I simply cannot get wx-widgets to work. After a workaround I was able to compile on my machine wxWidgets-3.0.2. I called from terminal make and make install, but the libraries seem to not be correctly installed. Indeed, if I create a project on Codelite I get many "wx-config: Command not found" errors. Can someone help me to get me started on installing the libraries and creating a simple project that includes wx-widgets?
I use homebrew which is installed by copying and pasting one line from the homebrew website.
Then, the installation of wxWidgets is simplicity itself with:
brew install wxmac
Any problems, you just call the doctor with
brew doctor
Now you have a proper package manager you can install ImageMagick, GNU Parallel, GNU awk, Oxygen, webkit2html, zeromq, tree, SDL, Redis, sqlitebrowser, pandoc, exiftool, ffmpeg, 7zip, awscli, etc...
You can then compile your wxWidgets programs with
g++ `wx-config --cxxflags` -o sample sample.cpp `wx-config --libs`
I can successfully compile and install wxWidgets on Yosemite with these commands:
- Get the latest sources of wxWidgets 3 from wxwidgets.org and unpack them.
- Move the unpacked directory someplace where you want to keep it.
- Open a terminal and change into the wxwidgets directory.
- Create two directories: build-release and build-debug (don't rename those!)
- Change into wxwidgets/build-release
- Run
../configure --with-osx_cocoa --disable-shared --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install
- Change into wxwidgets/build-debug
- Run
../configure --enable-debug --with-osx_cocoa --with-opengl --enable-universal-binary=i386,x86_64 --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6
- Run make, then sudo make install
Be aware that these instructions are for compiling against the Mac OS X 10.6 SDK, which I have at /Developer/SDKs/MacOSX10.6.sdk. You can try to omit the --with-macosx-sdk parameter altogether, which will compile using the latest SDK. Also ensure that you have Xcode and the command line developer tools installed.
These commands will install static libraries for the release build and shared libraries for the debug build. You can change this by supplying or omitting the --disable-shared parameter.
The instructions for building and installing wxWidgets are included in the distribution and can also be viewed online.
If your IDE doesn't find wx-config, you must not have the location where you installed it (/usr/local/bin) by default in your PATH. Add it there to fix this.
Like suggested by VZ, you must change your PATH.
But not the variable PATH in your environment Windows but the variable PATH in your C++ project. It's strange but maybe it's different.
Go into (for eclipse) :
C/C++Build->Environment->PATH (add the path of wx-config in the beginning).
Press : Apply, OK and build the project.
I think is strange that Eclipse don't update the PATH after rebooting the OS. Maybe we must add an option to Eclipse for building WxWidget and force Eclipse to update the PATH, but I don't know it.
This change work for me.
Eclipse / MinGW-MSYS / WxWidget 2.8

Error relating another make utility in one system

I have google how to install a gnu make file. And I follow the following steps:
$ ./configure
$ sh ./build.sh
$ ./make check
Unfortunately when I run the second command, my cygwin shell complains:
In file included from c:\qt\tools\mingw48_32\i686-w64-mingw32\include\sys\stat.h :14:0,
from ./makeint.h:71,
from ./ar.c:18:
./makeint.h:525:10: error: conflicting types for 'lseek64'
long int lseek ();
I am aware there is another make utility under the qt mingw, but how can i still proceed to install the new make?
The source distribution of GNU make from the FSF download site is not technically supported on Cygwin. Not that there's any known reason why it shouldn't work, but it's not tested and last I heard the Cygwin guys were maintaining some extra patches to GNU make. So it doesn't surprise me that there are issues.
Remember that you should only use the Cygwin version of GNU make if you're invoking make inside of Cygwin to build Cygwin applications. You should not use the Cygwin version of GNU make to build native Windows content outside of Cygwin. Do not mix them together.
You can build a native version of GNU make for Windows (not cygwin) by following the directions in the README.W32 file that comes with the source code. You can get binary versions by looking for MSYS / MinGW.
If you need a Cygwin version of GNU make, you should get ahold of the source code for GNU make from the Cygwin distribution and use that. If it fails to work, you need to communicate with the Cygwin folks about it.

Qt 5.1.1 compiler setup on Ubuntu

First of all, I should point out that I've never used linux before.
I have a clean install of 64bit ubuntu, I downloaded Qt 5.1.1 for linux 64 bit from http://qt-project.org/downloads, ran the .run file, installed it and gcc which is included in that download, opened Qt Creator, made a new project and tried to compile it. It wont compile and I keep getting this error message
:-1: error: Qt Creator needs a compiler set up to build. Configure a compiler in the kit options.
I added a gcc compiler, but what do I need to put for the compiler path, platform codegen flags, platform linker flags and ABI?
You don't have to input the path of your compiler because gcc and g++ paths are available in the $PATH enovironment variable. So just use "gcc" and "g++" and that should work. Just make sure you restart Qt Creator after the installation of g++.
One more thing. You need a compiled version of Qt installed on your computer. So also install Qt libraries with
sudo apt-get install qt4-dev-tools
If you want to use the new version of the library you have to add it to $PATH. You can do this in the terminal with
export PATH=/path/to/Qt/qtbase:$PATH
And then run Qt Creator from the same terminal, in which you did the last command.
Good luck!
You will have to install the dependencies as well. I got it working when I followed the steps in the following link.
Try this:
http://wiki.qt.io/Building_Qt_5_from_Git