Can I build wxwidgets with clang++? - c++

There are walkthroughs to build wxwidgets with common compilers on windows, such as MSVC or MinGW, but there are no options for clang. I do have the other two compilers, but I dislike using Visual Studio for projects that are not C# or other .NET languages and I just don't like MinGW, nothing specifically. I use clang to compile, and I'd like to build wxwidgets with it, but I don't know if it would error or not, so would it work? I'm using windows, if not already clear. Thanks in advance.

You can definitely build wxGTK and wxMac under Linux and Mac respectively with clang and I think people did build wxMSW under Windows with it too, but it's a less commonly used compiler there, so your best bet would be to just try doing it. If you run into any problems, please free to open tickets on wxTrac, we do want to support clang under this platform as well.

Related

Compiler installation which is simple

Is there any compiler for C++ that works under W7 and is easy to install, except VC++?
I never get these scripts and linux emulations to work, and really just want to try another compiler.
The nuwen distribultion of the GCC compiler includes the compiler and all necessary supporting tools and libraries as a single Windows installer. You don't need any Linux emulation in order to use it. A similar, slightly smaller pacakage is TDM's MinGW build. Both of these are on GCC 4.5 (as of Aug-2010).
If you want an IDE, then Code::Blocks also comes as a complete system. This has recently (Jul-2010) been heavily improved, and comes with the GCC 4.4.1 compiler, if you want it. You might also want to look at CodeLite, which is also fairly easy to install.
Mingw is generally easier than cygwin. It doesn't come with a port of every unix tools as cygwin does, but the resulting .exes are native (no need for cygwin.dll)
Cygwin includes the gcc compiler and also provides a Unix look and feel which will be the other thing you need to get scripts and linux emulations to work. (This inlcude the libraries Unix libraries will have functions that VC does not have which might be the issue that you are having)
Qt for Windows comes with MingW, which I've found to be reasonably easy to use and install, and the LGPL version is priced right (free as in beer). You don't need to use any the Qt libraries in your application. I'm not sure which version of GCC is currenlty bundled with it. There are no licensing restrictions for the software you develop (unless you're actually modifying and redistributing source code of the LGPL version of Qt).

Cross Platform C++ Tool Chain

Hello I am putting together a tool chain on my windows Box for Cross Platform C++ Development. I plan on using Boost.Build for building and Boost::Test for unit testing. I will be using Mercurial for my VCS because I can just throw the repo on my external HD and then pull it to either my windows or linux partition. The main thing standing in my way is editor compiler/debugger. Anyone have any suggestions?
With Boost.Build I can technically build with whatever compilers it supports easily. That means MSVC on windows and GCC on linux by using the same script with a flag.
Qt Creator using MinGW on Windows and the GNU compiler on Linux. That's what I use and it works perfectly well. Note that you don't have to use Qt when developing with Qt Creator.
May I suggest CMake on Windows and Linux as you can generate native Visual Studio projects as well as Eclipse CDT projects and plain-old makefiles.
If you are targeting multiple platforms, but find yourself primarily developing on a single platform, I highly recommend a continuous build/integration system to ensure a check-in for one platform does not break the build on the others.
Code::Blocks is a free, open source, cross platform C++ IDE. It supports the MS and GCC compilers, among others.
The main thing standing in my way is
editor compiler/debugger. Anyone have
any suggestions?
Yes: Qt Creator as one download and install will satisfy your three requests -- pick the 'LGPL' license route and download and install the SDK which even installs gcc, g++, ... for you. The integrated debugger is very good, and you get cross-platform behavior from both your code and your tools.
you can use gcc/g++ on windows as well. as for debuggers: gdb and ddd might be in cygwin. editor: vim (beware: it's really a programmable editor, not an IDE).
Vim, gdb, gcc/g++, makefile - you can use them on both - Windows and Unix :)
Yet another vote for Code Blocks or Qt Creator.
There are commercial tools too: beside Visual Studio there are MagicC++ (IDE), debuggers like TotalView, Allinea, Zero-bugs, UndoDB ... if you want to stay with VStudio check these VSBridge and WinGDB.
Anyway you can always use MSVC on Windows and other tools on Unix (gdb/DDD for debugging, vim/emacs for edition) - I've worked in this way a lot of years. Common environment for all platforms is nice, but sometimes it is very hard (almost impossible) to "force" it in company (especially big-company) ;-)

Crosscompiling C++; from Linux to Windows, does it really work?

I have the source code for some very simple command line programs. I was considering the option of compiling them on a Linux machine (they were deveoped here) so they can be used on Windows. If I am not wrong this is called Cross-compiling. I have never tried it, but reading yesterday some information, it seems to be kind of complicated or not successful. I would like to hear about your opinions, and how could I port a simple "hello world" program, which compiles on Linux with g++.
Thanks
Look into mingw, a suite of tools for building Win32 applications in Linux. If the programs don't depend on any Linux-specific functionality not supported by mingw, you should be fine.
Note that cross-compilation is not the same thing as cross-platform. With cross compilation, you compile the code to a Windows executable on the Linux box, then transfer the executable to a Windows box. With cross-platform, you transfer the source code to the Windows box and compile to a Windows executable using a Windows compiler.
The former is quite difficult (but not impossible), the latter is very easy, using a compiler such as MinGW, a others have mentioned.
I cross-compile on a daily basis. But I don't set up cross-compilers on a daily basis. It can be tricky, but it's certainly possible.
As long as you use standard C++ your code will be cross-platform. You can also use cross-platform libraries like STL, boost, Poco, Qt, etc...
Only when you start to use platform specific code you lose portability. For example including <windows.h> will make your code only compilable on Windows. (There are techniques around this like the #ifdef macro. This enables certain code portions only on one platform.)
So a simple hello world program should work on Linux, Mac, Windows or any other platform. You don't need anything special for this.
Note:
Some may mention Cygwin or mingw32. I'll briefly explain what they are:
Cygwin allows you to compile Linux applications using gcc/g++ on a Windows machine.
Mingw32 allows you to compile Windows applications using gcc/g++ on a Windows machine.
Edit:
If you want to setup a system for cross-compilation, then I recommend that you have a look at cmake.
Yes. We are currently compiling a 250 kloc app, running Qt with daily builds. It's working prefectly everyday, although I've to admit it is not distributed outside the company, but only used internal. For official releases, Visual Studio is prefered.
Compiled using mingw standard packages on Debian.

Do I really need Visual Studio

Do I really need Visual studio to build c/C++ application on Windows.
Is there any way to have makefiles and get the application built.
You can use any compiler that'll target Windows (for example, MinGW, Digital Mars, Comeau or others). All of them can be driven by the command line so you can use your preferred make utility (or other build utility).
That said, Visual Studio is pretty nice (even the free version). And don't forget that it installs the command line compiler tools, so you can drive it from a makefile as well (unfortunately, it won't spit out a makefile for you anymore, but it has it's own command line tools to drive a build based on project settings if you want to jump from IDE to command line builds).
If you want to stick to the Microsoft toolchain but don't want the IDE, you can use cl and link to build from the command line in conjuction with either the MSBUILD system or NMAKE.
If you don't have the compiler it is available free with VC++ Express.
To install the Microsoft compiler without installing an IDE download the Windows SDK which is available for free.
http://en.wikipedia.org/wiki/Windows_SDK
Qt is very nice, and downloading and installing the SDK gets you the QtCreator which provides a consistent IDE across platforms, with very nice builtin help, build system, access to revision control, debugging, ... and it even includes the MinGW compiler and toolchain for you.
MinGW is something simpler: the usual GNU toolchain but setup such that it provides native Windows binary.
Last but not least, there is Cygwin which gives you the most Unixy flavour.
No, you don't.
I know you said c, but you can also check out MonoDevelop, should you choose to do more than just that: http://monodevelop.com/Download
No you do not. There are many free IDE's out there, or you can do everything from the command line with a non-microsoft compiler.
www.bloodshed.net offers a pretty good IDE that uses the Mingw compiler.
You can even do without extra tools as long as you have the compilers on your machine. Take a look here for an explainatin:
http://msdn.microsoft.com/en-us/library/ms235639.aspx
Not at all. It is quite possible to do Win32 programing, including OS and GUI programming, with gcc from Mingw.
For all my hobby work, if I can I use the gcc compiler from Mingw (for C or Ada), with Emacs as my IDE and gnumake for my build system. There are good Mingw ports for all the major revision control systems too, including Git.
That's the toolset I used to create the SETI#Home Service, which was a wrapper for the SETI#Home client that installed and ran it as a Windows service, did failure detection and auto restarts, and had a built in web server for monitoring. All that with no VisualStudio.
You can use Eclipse with C/C++ Development Toolkit and with Mingw Compilers. the only problem is that you will not have M$ Stuff like MFC, but you can use QT or wxWindows
Two solutions that immediately come to mind:
Cygwin
MinGW
Using makefiles does not prevent you from using the Microsoft C++ compiler, which is nice if you want to use the VS debugger.

Best way to setup a Windows build environment for C/C++

Basically I want to compile C/C++ using the GCC on Windows. The two competing platforms, as i see it, are MinGW and Cygwin. Each have their own benifits and limitations. MinGW compiles for Windows, whereas Cygwin needs the cygwin .dll. However installing libraries on MinGW is difficult, whereas on cygwin it's easier, using the setup.exe as a 'package manager'.
My question is what's the best way to compile on Windows. Would it be better to use MinGW and struggle with libraries (in which case is there an easy way of installing libraries on MinGW). Or should I use Cygwin, if so how do I get it to compile without needing the cygwin .dll, effectively compile for normal Windows.
The easiest and best way to compile on windows is to use visual studio express. It is free. A good reason for using cygwin is for cross platform builds. A good reason to use gcc is it supports some compiler candy the Microsoft compiler doesn't.
But all in all VC++ Express is the way to go for windows only development.
There is always the option of using -mno-cygwin with Cygwin to compile against Windows libraries like MinGW does:
gcc -mno-cygwin file.c -o test
It's not an easy choice and mainly depends on how much you will rely on other libraries. Cygwin really adds an additional layer, which is heavier but "emulates" the Linux environment better than MinGW.
Edit:
Qt Creator allows you to compile with MinGW on Windows (and gcc on Linux, ...), has an IDE that makes debugging more friendly than gdb. If you need libraries, you still have the option of using the Qt libraries. That would be a good alternate solution to the Visual Studio if you really want to stick to gcc for future portability.
You might want to look at CodeBlocks. It is generally used to build WxWidgets apps, but it wraps MinGW nicely.
Actually, there's option #3: if your edition of Windows permits it, you can install Microsoft Services For Unix / Subsystem for Unix Applications, and then get gcc from SUACommunity. It has a package manager, too. Of those 3 options, this will give you behavior closest to a true Unix system.
However, the resulting applications aren't Win32 applications; they're SUA applications, and will require SUA to run. If you write code for yourself, it's usually not a problem if you write code for yourself, but if you want to write and distribute a proper Windows application, I would suggest staying away from anything that tries to emulate Unix, so MinGW it is.
Qt Creator comes with MinGW as standard and can be used to build projects that don't actually use the Qt framework.
There's an easy to install MinGW wrapped GCC at equation.com.
Click "Programming Tools" then "Fortran, C, C++", download the release you prefer, install and use.
One possible method is to use CMake which can build Visual Studio project from your sources and then compile from Visual Studio. It can build project for other IDEs too, so you can go cross platform.
I think the answer depends on whether you intend to use libraries or compile programs that are targeted to POSIX or a POSIX-based target. That's what Cygwin is intended for, while MinGW is more intended for compiling Windows-targeted programs using GCC.
Another option is TDM MinGW: http://www.tdragon.net/recentgcc/
It's basically an unofficial fork of MinGW with the latest GCC compiler available for both 32- and 64bit windows machines. Even some MinGW developers themselves use it.
Equation Gcc is even better: http://www.equation.com/servlet/equation.cmd?fa=fortran