[Qt-interest] Linking C programs with qmake
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Mon Dec 13 14:49:18 CET 2010
On 2010-12-13 Nikos Nikos Chantziaras wrote:
> I have a project that consists of only *.c files. Right now, I specify
> this in my *.pro file:
>
> QMAKE_LINK = $$QMAKE_LINK_C
> This seems to work just fine, but I have to wonder whether this is actually the
> correct ...
According to http://www.qtcentre.org/threads/29623-change-linker-in-qmake: "They [QMAKE_LINK and QMAKE_LINK_SHLIB] are not mentioned there [in the Qt docs]. Those variables are set by QMAKESPEC and shouldn't be changed."
So it looks like the Right Way(tm) seems to be so set QMAKESPEC to something like linux-gcc, if such a makespec was provided by Qt "out of the box". Well, I just checked, there isn't (not surprisingly, as Qt is a C++ framework ;) Create your own custom QMAKESPEC (qmake.conf, qplatformdefs.h).
That said, if the above works for you, then you can as well keep that solution - just be prepared to adapt your solution when Nokia decides to remove/change those undocumented qmake variables.
Then again, I strongly guess you would have to use QMAKE_LINK within your custom qmakespec configuration as well, so it does not really matter (at first sight) whether you use it therein, or in your own *.pro file (which is much simpler).
Ah, and while looking at the mkspecs/common/g++.conf file (which is included from e.g. mkspecs/linux-g++) it really seems as there should be a switch for selecting the language, as there are both
QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
QMAKE_LINK_C = gcc
QMAKE_LINK_C_SHLIB = gcc
defined.
I know that you can set the "language" of a given project, as in
LANGUAGE = C++
(which I guess is the default anyway).
Did you try
LANGUAGE = C
Does that make any difference?
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list