This is possible a duplicate, notheless old questions might be outdated.
I know the basic logging principles of Qt, using qDebug() << "error"
and I know that with Qt 5.2 categories where introduced (example found here: https://evileg.com/en/post/154/)
But I do not see that Qt provides a framework ready to use.
I would like to have a file write based logger, thread save, that is compatible with log4net (or log4j). Even if not with the output of log4net it should be stable and proven to work.
I found log4qt
https://sourceforge.net/projects/log4qt/ But the source does not even include a make file or anything to make it. Also the code is from 2009 and very likely outdated.
I also found the log4cxx, but that is based on Linux compile tools and I could not find out how to make it using ming32 on windows. Since I dislike to invest hours to even compile a framework I rather not want to use this framework.
Is there anything more modern, up to date for Qt, usable on windows?
Related
Let me preface this by stating I have vision problems so I have to magnify my screen upwards of 400% minimum to read most things including code - even when I am using a dark theme as I do when I code.
QTCreator has an issue where it moves the view on me with most keystrokes & actions - usually to the top left corner by the project file listing. I've posed questions to QT Support and even cloned the source for QT Creator looking to see if I could identify a relatively easy fix - to no avail. So now I'm trying to find a free (as in no financial cost) alternative to QT Creator so I can keep programming using QT Creator in C++.
I've tried Visual Studio Community Edition (2017 and 2019) and had problems getting things to build. It seemed like I had to rebuild the entire framework libraries for MSVC or else it wouldn't work. Additionally it seems it finds compilation errors in even the framework source - which doesn't even look wrong to me or I'd try to repair it.
I tried Eclipse (as I'm a Java engineer for my job so I'm familiar with Eclipse for Java and it does not have the problem that QT Creator has. The QT plugin - when I try to put a simple line of #include - It claims "QApplication" is unresolved. I've looked for this and all the answers say about Project->Properties->Paths and Symbols but as of 2019-12 and 2020-03, there are no options in settings for paths and symbols unfortunately.
A colleague suggested CLion from JetBrains but unfortunately it appears you have to pay for that. I have no intention of paying for a compiler or IDE.
Any thoughts on how I can get around this view changing problem or an alternative to QTCreator that doesn't cost money? If there's a setting in one of the applications I may have missed, suggest it with the version of the appication and I'll look for it and reply if it doesn't exist for whatever reason or accept your answer if it does and fixes the problem.
Thank you!
If you are familiar with Eclipse but have issues with the plugins and you intend using it for C++ I recommend checking out Cevelop (https://www.cevelop.com/) it's basically Eclipse but only for C++ and has some optimizations.
If that doesn't work for you technically you should be able to use any code editor like VSCode or Atom, but I do not know how well that works with the Qt library.
CLion is free for students but I think that doesn't apply for you.
NetBeans (https://netbeans.org/) is also free and cross-platform.
(https://netbeans.org/kb/74/cnd/qt-applications.html)
It should be possible to use Qt within the IDE.
I finally solved this amusing riddle so I'll answer my own question.
It drove me half nuts though, so I guess it might help a few fellow programmers.
Problem definition
What I want to do seems fairly simple: create my own widget and integrate it to my own Qt Creator (the version that runs on my local machine, as shipped with the standard Qt install) so that I can use it freely to design my own interfaces with the ad hoc GUI design tool.
Promoting a generic QWidget works adequately, it's just not very convenient.
I thought seeing the widget in the GUI design tool (instead of an invisible rectangle) and having the possibility to modify specific properties (instead of having to do it programmatically) would be nice.
Unfortunately, this did not go as smoothly as I hoped.
I can’t even be responsible for my own compiler!
Using:
a pristine Win 10 on a freshly reformatted system, with no previous compilers whatsoever installed
the default free version of MSVC 2019 (desktop C++ development pack, toolchain v14.26, compiler v16.4) downloaded by the standard installer
the default current Qt v5.14.0 (MinGW and MSVC2017 targets), downloaded by the standard Qt installer.
I started by naively compiling the example (the clock widget) for x64. Nothing happened. Then x86. Same result or lack thereof.
I actually realized this was conceptually wrong just before trying to compile it for MinGW.
Clearly the produced DLL had to match the native format of the actual Qt Creator, so this idea of the makefile magically adding a plugin to the current Qt Creator binary was all rubbish.
I gave up the wishful thought and set off to put the proper bit of DLL in its proper place by hand.
That's where I went astray for good.
I soon saw that the Qt Creator executable being shipped with Qt 5.14.0 has been compiled with MSVC2017 in win32 mode (that's stated in the "about" window, though no precise version of the compiler and/or toolchain is clearly stated, just this rather unreliable "MSVC2017" which is also used to designate an actual MSVC2019 environment).
The path defined in the example project was leading to some cryptic MSVC2017 subtree where nothing happened at all.
Putting DLLs there had no effect. Deleting the ones that were already present had no effect either.
Clearly my version of Qt Creator never used any of these DLLs. I have no idea what use they are supposed to be and frankly I could not care less. It was just another cold trail that wasted a bit more of my time.
Looking at the "about plugins.." window from Qt Creator, I noticed that all plugins listed there were located in <Qt install root>\Qt\Tools\QtCreator\lib\qtcreator\plugins\ (as stated in the windows that opens when clicking the "details" button).
I wrongly assumed this was were all plugins should go.
However, putting the result of the standard example (the cute little clock widget) into this directory did nothing at all.
I then lost a whole day trying to understand why in the blazes this bloody plugin would not show up.
Since the current MSVC integration is somewhat whacky (Qt still refers to MSVC2017 while using the binary compatible MSVC2019), I set out to try and use the v14.16 Microsoft toolchain (the last using MSVC2017 that can be installed with the Web installer).
I never managed to make this bloody older version of the toolchain work.
Frankly this Qt/VS integration is a quagmire. It boils down to calling this horrendous "vcvarsall.bat" command file that sets up a truckload of cryptic environment variables.
As it happens, vcvarsall.bat requires an extra command line argument (-vcvars_ver=14.16) that Qt is unable to pass (it considers the compiler definition invalid instead... What a rotten luck...).
You can still wrap the call into yet another batch file (#vcvarsall.bat %* -vcvars_ver=14.16) and feed that to the Qt compiler setup.
But even then I never could bring the bloody thing to compile.
I got missing includes and whatnot. Clearly the IDE must make some other assumptions about whatever file locations that make it impossible to work outside the "autodetected"' MSVC versions (namely the MSVC2019 current version in the present state of things).
I was mightily pissed off after all this painful waste of time, so I scoured the Qt forums again and got cluttered by countless (mostly Linux) discussions about paths and compiler options. More time wasted. A lot of time, actually.
In a last desperate attempt I used the nifty process explorer (that's right, spying on all resources opened by an executable) to locate the DLLs used by my running copy of Qt Creator. That is when I finally located the go[beep]mn directory.
From there on everything went quite smoothly indeed. Just compile your little DLL and put it in the right place, and Bob will be your uncle.
A bit of bullshit lore
There are two informations that might lead you to think the designer plugins live either in
Qt\Tools\QtCreator\lib\qtcreator\plugins (the path reported by the "About plugins..." window)
or
Qt/5.14.0/msvc2017/plugins/designer (the cryptic install path used by the example project)
Both are wrong and misleading.
Another bit of lore pretends the Qt Creator executable requires the exact same version of the compiler to produce compatible plugins.
This is another piece of bullshit. You can very well compile with MSVC2019 for the current version of the tool, that has apparently been compiled with MSVC2017 (though the about window does not say with which exact version of the toolchain or compiler, alas).
All you need is a binary compatible DLL (obviously), that means a Win32 compilation from a binary compatible Microsoft compiler (which could theoretically be as old as MSVC2015, as far as binary compatibility is concerned, but since apparently nothing but the latest version of the toolchain is likely to ever work, this is of purely academic interest).
It is not even necessary to compile in release mode, apparently debug DLLs work just as well.
Trying to make the previous version of MSVC work is not only a nightmare of undocumented and cryptic failures, it is also totally useless.
And the solution is...
Just build the project for MSVC 2019 (what Qt calls MSVC2017 for some reason) in WIn32/release mode and put the go[beep]mn resulting DLL into this directory:
<Qt install root>\Qt\Tools\QtCreator\bin\plugins\designer
Yup, that's right. You get a Qt\Tools\QtCreator\lib\qtcreator\plugins where strange things seem to happen but no "widget plugin" will ever be loaded, and another Qt\Tools\QtCreator\bin\plugins with a bunch of subdirectories, including the "designer" folder where your little "widget plugin" will finally come alive.
You get also a lot of bullshit and/or outdated tips from various Qt forum threads. Apparently Qt is crawling with a truckload of different "plugins" that don't all live in the same hovel and love to migrate with each new minor version...
I could find no hints or lists of useful directories in the Qt documentation either. And believe me, I did read quite a lot of Qt documentation.
And btw, to make use of your reusable widgets you will still need to provide either their source code or an interface header and some DLL/LIB for linking.
This "plugin" thing is a nice way to integrate your widget to the GUI editor, but it will not install a library containing your widget nor its interface header (that would be a nifty trick indeed :)).
Bloody awful nightmare. But now it's over and playing with my little custom widget cuties is a load of fun. Yay...
I am new (relatively) to C++ and to SO.
Having stretched the creativity of console applications to the limit, my very rabid mind wants to know how to code GUIs now. I did some research, decided to use GTK rather than Qt because of having freedom of choice, there being no strings attached and something about slow internet and having to download some 0.6GB were I to go with Qt.
It has been a brutal 48 hours trying to build 'Hello World' on Gtk. This is me throwing a tantrum. I'm using Visual Studio 2010. Perhaps this is the source of all my woes. It seems Gtk is meant for C and not C++. After solving issues with header files includes and a certain notorious glibconfig.h missing (which I downloaded from the internet only to find, to my horror,that it is supposed to be a generated file), the compiler threw syntax errors,especially in one gatomic.h.
I suspect 10 errors will come up for every one I manage to solve. This is where you come in. Do you use Gtk to develop c++? If not, why so? What would you recommend instead? Do you use Gtk on windows? How is that possible? Please give details.
Is it possible to make cross-platform apps that use C++ code and a Python/VB GUI?
Your answer will be sincerely appreciated.
First off, a general note: Gtk being mainly developed as a toolkit for Gnome, I think it is fair to say that the main focus is high quality on Linux while other platforms are somewhat second-class citizens. This is probably most visible by looking at the integration with the native look and feel of Windows and MacOS. If you are looking for a toolkit which behaves equally well on all major platforms, I'd recommend you reconsidered Qt.
As far as your more specific questions are concerned:
C/C++
Gtk is written in C, and consequently has a C API. If you are looking for a C++ API, look at the Gtkmm bindings. Note that you can also use the C API in a C++ application.
glibconfig.h
I don't know whether you tried compiling Gtk yourself, but the easiest way to get Gtk3 for windows is by downloading the precompiled all-in-one bundle from http://www.gtk.org/download/win32.php (which includes the glibconfig.h you are missing).
When and how to use Gtk and with what language
As pointed out above, the primary users oft Gtk are people who develop applications for the Gnome desktop environment. Most cross-platform applications nowadays however use Qt since the quality on Windows and MacOS is higher compared to Gtk on those platforms.
Concerning what langauge to use, a strength of Gtk is that there exists bindings for many languages (including C++ and Python), so you are certainly not confined to C.
When developing with C++, something that I personally like about Gtkmm is that it uses the standard library, as opposed to Qt which has it's own implementations for data structures etc (the reason being that Qt predates the times when the STL was generally available and usable on all main platforms).
How to use Gtk: contrary to Qt which has the excellent Qt Creator, Gtk is somewhat lacking a specifically designed IDE for easy development. The closes you'll get is using Glade for interface design and a text editor or IDE of your choice for the coding, but that choice will differ depending on the platform you are on. Clearly, as you probably noticed, integrating Gtk into the environment of choice usually requires some work (and also some more technical knowledge). So again, if you are looking for an easy to set-up and use environment for developing GUI applications, I'd just go with Qt and Qt Creator.
Cross-Platform apps
First off, Visual Basic is not cross-platform. But generally speaking, there are plenty of possibilities for doing cross-application development, using various languages.
I've had to get a gtk3 project working on windows a few months ago, when gtk3 just came out for windows. I've had problems compiling it under Visual Studio as well, and posted a question here, specifically this one.
Here's how I got it working on windows:
Download the all-in-one bundle for Windows from gtk.org
Install, etc, set up include/link dirs within the project. (personally, I dumped gtk's folders in the project folder, pointed at "include" as an include dir and "lib" as a link dir, then proceeded to move any files/folders the compiler cannot find around to the root of "include" )
If not set up automatically, add include and link dirs as necessary until the compiler finds all the files.
If using MinGW to compile, it will succeed at that point.
If using Visual Studio, you have to modify gtk headers as described in the gtk mailing list:
In gutils.h lines 82 and 122, and in gstring.h line 129, change
"static inline" to "static __inline".
Blockquote
Note that the modification does not impact MinGW's ability to compile.
I have successfully compiled my gtk3 project on both windows (with either Visual Studio or Code::Blocks) and linux without writing platform-specific code that way. Just don't forget to include the required runtime dlls with the program when you ship it.
I've been working on some C++ code that some of the other developers I work with will use. A lot of the developers here are MS based (they use Visual Studio as their main IDE) we also have a lot of developers who use other IDE's as well for different projects (like Eclipse and Qt, even some C++ Mac development with XCode).
The code I have are generic library functions that are cross platform compatible, so it will be used by different developers on different platforms/IDE's. Which brings me to my question: is there a compatible Doxygen comment 'style' that can be 'understood' and used with the code completion ability by most popular IDE's (VS, Eclipse, Qt, Netbeans, XCode)?
Something like VS's IntelliSence where when you use your scope resultion a description pops up for that item.
If there is not a 'compatible' way, are there any plugins that can be used for all IDE's that would allow for this ability, or would I have to write my own? Googling has lead me to many dead ends (possibly because I may not be inputing my question into correct search terms), and writing my own plugins is an option, though I'd prefer a 'compatible' style or existing plugin if possible to save time.
Thanks in advance!
Edit 1: I should mention that I am requesting Doxygen style commenting becuase it is the documenting tool we use to build out some of our documentation thus all comments in any code we make must be Doxygen style (not sure why this issue never came up before here, haha)
So I have been struggling with this question for awhile now. In the past I have used several different software suites for development, with each having its own quirks in regards to using the documentation to drive some of the more fancy features. After working on a project in C# (and Visual Studio 2010) I have come to realize that the XML commenting seems to work the best for me.
I personally believe that this is a failure in most of the IDE applications themselves, for example, it seems that Visual Studio really only supports XML commenting for C# applications to feed features such as Intellisense, and the less fancy syntax highlighting. I have found that there is a commercial plugin available to "enable" this feature in Visual Studio, but why should I pay for something that just has not been enabled?
But I have diverged from your original question. When I was first researching this it seemed that Apple themselves must use Doxygen as they seem to use this standard for highlighting code already. With that said, here are some other resources to get the same functionality in other applications:
Atomineer Pro Documentation seems to be the tool for the job in regards to Visual Studio although I have not personally used it. It seems relatively simple to use.
Eclox seems to be a front-end plugin for Eclipse that actually uses Doxygen. But from what I remember you should be able to tweak the IDE itself in the C++ settings in regards to syntax highlighting.
Doxymacs maintains a symbol table inside of Emacs for some quick searching abilities.
It seems that on the Vim project page there's a script that handles this for that editor as well, it is called DoxygenToolkit.
I absolutely feel your pain. There's something warm and toasty about having a nightly crontab generate cleanly documented markup that is easily searchable. I have only recently been on a warpath for finding the best mechanism available for achieving this cross-platform. From what I've gathered most development environments support extensions of sorts, and since Doxygen is basically the "gold standard" there's usually one way or another to shoehorn support in if it doesn't exist out of the box.
If you're interested Doxygen actually supports the C# XML comments out of the box, but unfortunately I wasn't able to get it working in Xcode, and I'm not well versed enough in AppleScript to hack it together. But by all means please update if you do!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I want to do some coding in my spare time, but the thing is, I don't want to spend the money on this.
Would the following set of development tools be The Right Thing, or is there something I'm forgetting?
Eclipse for C++
SVN for source control
Qt for UI development (since it's C++, and I believe it's now opened by Nokia)
hudson for continuous integration
I'd like to write a little image processing application that can run on any platform, but the main platform at the moment will be Windows with a possible movement to the Mac-- hence all the cross-platform tools.
Is there anything really obvious I'm forgetting? Like something like fxcop for style checking in C++?
If I use any libraries, I'd like to avoid GPL libraries; if things go south with my current employer, I'll want to monetize this.
Microsoft Visual C++ Express is free and easily the best IDE for Windows. Furthermore, you can use it to work on cross-platform code - it more depends on writing standards-adhering code and using portable libraries.
If you want to write cross-platform code, I recommend a cross-platform build tool. I use CMake, which generates Visual Studio solutions on Windows, but there are others too, such as SCons.
As for libraries, it depends on what exactly you need to do. Qt is an excellent GUI library. libpng/libjpeg and others are good for loading/saving images at a low level, but there are probably other higher-level image libraries as well.
[edit] A response to the comment about MSVC and Qt:
A quick search brings up Trolltech's Qt Visual Studio Integration page:
Qt Visual Studio .NET Integration
A comment points out that this is actually not free (a free addon is available at this link, but this runs Qt designer outside of Visual Studio. Also, the Express version of Visual Studio does not support plugins.
For coding specifically in Qt there is another new IDE created by Qt: Qt Creator. I've heard good things about it, and it is also portable across Windows, Linux, and Mac.
I detect procrastination (something I'm often guilty of) - just write some code - you can always add tools as you go along.
The problem with questions with phrases like "what's better" is that it's really hard to determine what's right in a specific situation and maybe impossible what's "better".
Said that, I use Eclipse CDT sucessfully as an IDE on Linux. I use frameworks like ACE/TAO to create code that is highly portable.
I know that QT is a very good UI framework. KDE is built on top of KDE and if you use KDE/Linux then you may also want to look at KDevelop, a C++ IDE that has many users.
In the end I believe that you and only you can figure out whats best for you to use. Make sure you check the alternatives and then make an educated decision.
for c++ there are a few more freewares available such as codeblocks and devcpp. I find eclipse very heavy on the machine.
There are many tools that make the difference:
A C++ compiler ... (it wasn't in your list)
doxygen
STLfilt (which is a must have when programming in C++)
A UT framework (CxxTests, boost.test, Fructose, google.test, ...)
something to manage the compilation chain (scons, aap, (b)jam, cmake, ...) -- I've no idea what eclipse is using.
Source control: git. It's not as diffucult as people make it seem. I'm an svn newbie and I still managed to learn the basics of git for use in everyday life! There are about 4 or 5 basic commands that will get you going in no time. Read the official git tutorial
Regarding IDE's, there are a few choices
Microsoft Visual C++ Express Edition (free lite version)
Eclipse with CDT
QtCreator. (Since you're using Qt for the GUI)
Personally I have used Eclipse+CDT for a number of projects. Paired with wxWidgets it has provided me with enough to keep myself pretty much crossplatform (which I think is a big plus).
Also QT has some interesting releases with an IDE now, make sure you check it out: http://www.qtsoftware.com/products/developer-tools
Like earlier suggestion, just start coding, you will eventually find out what is the appropriate mix for you. It varies greatly between individuals what is the "best" IDE or mix of command line tools, etc.
Eclipse CDT is making huge strides, and even organizations that were unx tools only are now finally joining the IDE bandwagon. Considering downloading a current milestone, not the official release.
If you're using windows, don't use Eclipse directly, find a third-party distribution that already has all the GNU tools in it (I forgot the name, I can look it up).
Once you switch to mac it's easier, but make sure to install xcode to get your GNU tools.
If you are using svn - VisualSVNServer is an excellent free GUI based way to setup and administer your SVN repository, definitely worth checking out as it means you have little/no messing about with config files etc. to change your repository.
Regarding version control - Subversion is pretty much standard and is very well supported. From what I've heard, Git is more powerful but harder to use; it's worth a look for a new one-man project, since you wouldn't have the support and retraining concerns that other projects would have.
Regarding IDE, since Visual C++ Express is currently the highest-voted answer - I've used both Eclipse and Visual C++ Express. I don't have a whole lot of experience with Visual C++ Express, so it might have features that I've overlooked, but from what I've been able to compare, Eclipse offers a lot more features. I tried to list its more impressive features in this answer; from what I've been able to see, Visual C++ Express doesn't have any of the features listed there. Eclipse is slower and more resource-intensive, but with a fast enough desktop, its extra features are more than worth it.
In terms of version control, use git and throw your project on GitHub or Gitorious. There's really no reason to use Subversion anymore, due to its painful branching and merging, and lack of a distributed model.
See this link here for why Git is better than X:
http://whygitisbetterthanx.com/
There's also no point in using Sourceforge or GNU Savannah, as the Git front-end sites have much more valuable features and are easier to use.