Salutations. Currently, I use Eclipse (Galileo) with CDT and Boost libraries in OS X 10.5. I have begun the adventure of learning Qt, and I have installed the free version of the Qt SDK. I have grown quite accustomed to Eclipse, but unfortunately, integration has not been developed for Eclipse in OS X yet.
My question, therefore, is whether I can set Qt Creator to load template files for my header and source files (e.g., Doxygen comments in the headers and C++ comments in the source files). In Eclipse, I can accomplish this in the Preferences > C/C++ > Code Styles > Code templates.
Thanks.
In recent versions of Qt Creator, you can add a header (i.e. for licenses and copyright notices) in Options (Preferences on OS X) -> C++ -> License Template. You can also modify certain Qt specific aspects of the project, like how to integrated UI files ( Options -> Designer). More sophiscticated settings are requested (see https://bugreports.qt.io/browse/QTCREATORBUG-126), but not yet implemented.
I believe you because Qt Creator 1.3 touted the idea, but whenever I load the preferences, I do not see License Template available. I have downloaded Qt Creator at various times and even attempted to compile it from source code, but I still have not found this option. I might be overlooking the option (perhaps in a different menu location), but I certainly have not found it where you suggested.
EDIT
I may have found the option. I assumed it was a separate subsection under C++, but it is actually a line edit box accepting a filename. Thanks for your help.
Related
I am on MacOS 10.13.3, using Xcode 9 as my IDE, and trying to include Qt 5.10 in my Xcode project. I have installed Qt (with docs and examples) with Homebrew and ran many of them in QtCreator. Everything worked well up to this point.
My Xcode project is an extensive, complex project, the development of which has been active for a few years now, so switching to QtCreator or changing the structure of my project is not an option. I really need to add Qt to my existing Xcode project, which IMHO should be quite a natural thing to do given that Qt is a software development framework. However I have not been able to accomplish that yet. The upside is that in the process I have been learning quite a bit about Qt and its ecosystem. I now know how to use qmake, how to set up and successfully compile a project in QtCreator and how to create an Xcode project from QtCreator using qmake. As I said, I have been running many Qt examples and read pretty much every piece of documentation, blog and SO post I could find about this subject. To my surprise I haven't found a direct solution to this problem anywhere on the net.
So far I have included in my Xcode environment QtCore.framework, QtWidgets.framework and QtGui.framework, configured Xcode with the right search paths (Qt finds its files and frameworks) and include the right Qt headers in the code. However upon building my target I get a series of meaningless compilation errors.
Basically - if my understanding is correct - I can't just import Qt's components and frameworks I need, and set the right paths in Xcode just like I would do with any other framework. Qt 'features' a preprocessing step using MOC and UIC that sets it apart from other tools. So I examined the output of qmake and there are two files that the building system produces - qt_makeqmake.mak and qt_preprocess.mak which I think are responsible for the code generation step. Basically this is what I don't know how to translate into my Xcode environment.
Please feel free to tell me if my approach is not correct.
I am open to any advice or suggestion.
I would really like to integrate Qt into my project as Qt is such a powerful and complete framework. I hope someone will be able to help.
Thank you.
1 / In addition to setting the right path to Qt libraries and header files, which is fromwhat you said already done, you need to invoke the moc (Meta-Object Compiler) on your own Qt class which includes the Q_OBJECT macro. (basically every class you have made that are using signal/slot system).
MOChttp://doc.qt.io/qt-5/moc.html
This step must be done BEFORE compiling the project, and the result (the cpp generated moc files) must be compiled AND linked.
Now I am not an expert in XCode and MacOS development but for sure you have a way to add a custom step in your build process for doing that
2/ For UIC files : follow approximatively what is explained here (answer of Preetam, not the one validated) to obtain a .cpp and an .h file that you must include in your project too.
Hope this answer will help and point you toward the rigth direction.
Here is a post explained more in detail what I explained :
https://fmilicchio.bitbucket.io/2013/01/xcode-and-qt4-and-qt5/?
I try to use Xcode (v.7.3.1) for my C++ project (build system - make), but the experience is quite poor (and it was always like that since old versions like v4 when I started using it) - code completion doesn't work, color syntaxing works oddly (no coloring sometimes, or partially colored code), no "jump-to-definition" functionality, can't switch b/w header/source files with shortcuts. Basically, it's just a text editor where I have to use "Find" and Cmd+Shift+O all the time.
Is this intentional and Xcode will never get any proper support for C++ projects with external build system (make) or am I misconfiguring my project? How can I re-index files in the project? How can I make code completion work?
Thanks,
I believe there is a way to use Xcode with makefiles by adding an external build target, file->new->target->External Build System.
This is an older tutorial but the steps may be worth looking through: http://web.ist.utl.pt/jose.alberto.coelho/mac/MakefilesXcode.pdf
I've never had a problem with the syntax highlighting, but I remember the refactoring support being limited for C++ in some ways.
So, I ended up using this workaround: even though, I use external build system, I create Console Application project in Xcode and choose C++ language in settings. Then, I simply add my source files to the project (just drag folders from the Finder window) and then manually create project targets of type External Build System as I need. I don't use default target and don't use generated main.cpp file at all.
My files get indexed with no problems. I'm also able to debug code as I used to.
I still think Xcode developers should review indexing process for the projects with external build system...
Thanks for all the insights though!
I have lots of useful platform independent code made in C/C++ such as string/number/private data management, etc.
Now, as a starter to programming to iOS, I want to re-use the library for my project.
I don't think I can use it directly, but before starting, I want to check, but not easy to find the answer at this time.
What I want is
Implement a C++ library with public header files for iOS (not MacOSX) in Xcode.
Build them and get libProject.dynamic / libProject.a / other header files.
Integrate them into Xcode so that other separate client app (object-c) can use it.
If someone help me brief introduction how to achieve above or any other reference would be appreciated.
Thanks,
Hana
In Xcode, you can simply choose "New Project" from the "File" menu, and from the project template chooser, click on "Framework & Library" under the "iOS" section. There is a single entry - "Cocoa Touch Static Library". Use that as your Xcode project template to make the static library. Then you can include it in your other projects just like you would any other static library.
I have been using Qt Creator as an IDE for some C++ project (non-QT) and I love it. Recently I have been thinking to try out Eclipse mainly for learning a new tool and also the fact that I'm not a big fan of the debugger mode in Qt Creator!
Anyhow, I figured I could potentially use the makefile generated by the qmake, but though hey let's also learn CMake! So, I was wondering if someone could point me to some nice tutorials on this (I have not had much luck myself)? Specifically, I like to have the ability to create and maintain CMakeList.txt files and build/run the project directly within Eclipse ... just as you would by editing a .pro file inside Qt Creator.
Thanks
CMake includes an Eclipse CDT4 generator since version 2.6; you should probably take a look at this page, it explains three different possibilities for using Eclipse and CMake together. From my personal experience, solution 1 works pretty well in Unix environments.
i want to get the intellisense in GTkmm application, similarly as we get in dot net under windows. However this time i am using Linux, C++, Gtkmm and Geany as my editor. Please guide how to get the intellisense. Moreover, if any kind of editor supports the property of intellisense, please mention that also.
Thanks and Regards
Owais Masood
Geany automatically indexes your open files for auto-completion, but if you want it to index some library or API, you have to create a global tags file like it describes here in the documentation. I have had mixed results getting this to work completely and correctly though.
I used to use Geany on Linux, but I have moved to QtCreator. Even though it has an emphasis on Qt, you can use it on any C or C++ project (you just have to specify your own build process or do it outside the IDE). The editor is one of the best I've used on Linux and the autocompletion works great without a whole lot of configuration. Also check out my answer here on how to set the include paths. Anything in the include paths will be indexed for autocompletion automatically.