<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila]]></title><description><![CDATA[<p dir="auto">É um projeto simples com finalidade de aprender a usar o subprojetos.</p>
<p dir="auto">Erros q acontecem:<br />
C:\Projetos-Qt\testeSubdir-build-desktop-Qt_4_8_0_for_Desktop\mainwindow/../../testeSubdir/mainwindow/mainwindow.cpp:15: undefined reference to <code>functions::functions()' debug/mainwindow.o:C:\Projetos-Qt\testeSubdir-build-desktop-Qt_4_8_0_for_Desktop\mainwindow/../../testeSubdir/mainwindow/mainwindow.cpp:31: undefined reference to </code>functions::sqrt(int)'</p>
<p dir="auto">fontes:<br />
<a href="http://functions.pro" target="_blank" rel="noopener noreferrer nofollow ugc">functions.pro</a><br />
@HEADERS += <br />
functions.h</p>
<p dir="auto">SOURCES += <br />
functions.cpp <br />
main.cpp<br />
@</p>
<p dir="auto">functions.h</p>
<p dir="auto">@#ifndef FUNCTIONS_H<br />
#define FUNCTIONS_H</p>
<p dir="auto">#include &lt;QObject&gt;</p>
<p dir="auto">class functions : public QObject<br />
{<br />
Q_OBJECT<br />
public:<br />
functions();<br />
qint32 sqrt(qint32 i1);<br />
signals:</p>
<p dir="auto">public slots:</p>
<p dir="auto">};</p>
<p dir="auto">#endif // FUNCTIONS_H<br />
@</p>
<p dir="auto">functions.cpp</p>
<p dir="auto">@#include "functions.h"</p>
<p dir="auto">functions::functions()<br />
{<br />
}</p>
<p dir="auto">qint32  functions::sqrt(qint32 i1)<br />
{<br />
return i1 * i1;<br />
}<br />
@</p>
<p dir="auto"><a href="http://mainwindow.pro" target="_blank" rel="noopener noreferrer nofollow ugc">mainwindow.pro</a></p>
<p dir="auto">@QT += gui</p>
<p dir="auto">INCLUDEPATH += ../functions</p>
<p dir="auto">HEADERS += <br />
mainwindow.h</p>
<p dir="auto">SOURCES += <br />
mainwindow.cpp <br />
main.cpp</p>
<p dir="auto">OTHER_FILES += <br />
../functions/functions.pro<br />
@</p>
<p dir="auto">mainwindow.h</p>
<p dir="auto">@#ifndef MAINWINDOW_H<br />
#define MAINWINDOW_H</p>
<p dir="auto">#include &lt;QWidget&gt;<br />
class QLineEdit;<br />
class QPushButton;<br />
class QLabel;<br />
class QHBoxLayout;<br />
class functions;</p>
<p dir="auto">class mainWindow : public QWidget<br />
{<br />
Q_OBJECT<br />
private:<br />
QLineEdit *_editValor;<br />
QPushButton *_btnSqrt;<br />
QLabel *_lblResult;</p>
<pre><code>QHBoxLayout *mainLayout;

functions *fs;
</code></pre>
<p dir="auto">public:<br />
explicit mainWindow(QWidget *parent = 0);</p>
<p dir="auto">signals:</p>
<p dir="auto">private slots:<br />
void executar();<br />
public slots:</p>
<p dir="auto">};</p>
<p dir="auto">#endif // MAINWINDOW_H<br />
@</p>
<p dir="auto">mainwindow.cpp</p>
<p dir="auto">@<br />
#include "mainwindow.h"<br />
#include &lt;QLabel&gt;<br />
#include&lt;QPushButton&gt;<br />
#include&lt;QLineEdit&gt;<br />
#include &lt;QHBoxLayout&gt;</p>
<p dir="auto">#include "functions.h"</p>
<p dir="auto">mainWindow::mainWindow(QWidget *parent) :<br />
QWidget(parent)<br />
{<br />
_editValor = new QLineEdit;<br />
_btnSqrt = new QPushButton;<br />
_lblResult = new QLabel("Result");<br />
fs = new functions;</p>
<pre><code>mainLayout = new QHBoxLayout();
mainLayout-&gt;addWidget(_editValor);
mainLayout-&gt;addWidget(_btnSqrt);
mainLayout-&gt;addWidget(_lblResult);
setLayout(mainLayout);

connect(_btnSqrt, SIGNAL(clicked()), this, SLOT(executar()));
</code></pre>
<p dir="auto">}</p>
<p dir="auto">void mainWindow::executar(){<br />
qint32 i1,i2;</p>
<pre><code>i1 = _editValor-&gt;text().toInt();
i2 = fs-&gt;sqrt(i1);
_lblResult-&gt;setText(QString::number(i2));
</code></pre>
<p dir="auto">}<br />
@</p>
<p dir="auto">main.cpp do subprojeto mainwindow</p>
<p dir="auto">@#include &lt;QApplication&gt;<br />
#include &lt;QStringList&gt;<br />
#include &lt;QDebug&gt;<br />
#include "mainwindow.h"</p>
<p dir="auto">int main(int argc, char *argv[])<br />
{<br />
QApplication app(argc, argv);<br />
mainWindow *mainW = new mainWindow();<br />
qDebug()  &lt;&lt;  0;<br />
mainW-&gt;show();<br />
return app.exec();<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/topic/24296/duvidas-ao-usar-subproject-projeto-compila-mas-quando-um-faz-referencia-a-outro-não-compila</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 09:09:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/24296.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Feb 2013 11:46:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila on Mon, 18 Feb 2013 16:39:05 GMT]]></title><description><![CDATA[<p dir="auto">Só comentando o que voce publicou, em um projeto de subprojects voce tem que ter um com a funcao "main" e que seja do tipo app... e em cada subproject vc tem que especificar qual vai ser o resultado da compilacao... se eh uma dll ou um aplicativo... No seu projeto <a href="http://functions.pro" target="_blank" rel="noopener noreferrer nofollow ugc">functions.pro</a> e <a href="http://mainwindow.pro" target="_blank" rel="noopener noreferrer nofollow ugc">mainwindow.pro</a> voce nao trabalhou isso direito...</p>
<p dir="auto">procure sobre o comando $$PWD ele especifica o diretorio principal do projeto, e a variavel DESTDIR, que especifica o local onde os binarios serao salvos aposa compilacao...</p>
<p dir="auto">vc tambem pode especivicar $$DESTDIR para, por exemplo declarar bibliotecas compiladas pelo projeto.</p>
]]></description><link>https://forum.qt.io/post/167671</link><guid isPermaLink="true">https://forum.qt.io/post/167671</guid><dc:creator><![CDATA[Rodrigocg]]></dc:creator><pubDate>Mon, 18 Feb 2013 16:39:05 GMT</pubDate></item><item><title><![CDATA[Reply to Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila on Mon, 18 Feb 2013 13:23:17 GMT]]></title><description><![CDATA[<p dir="auto">Obrigado Rodrigo irei estudar estes fontes</p>
]]></description><link>https://forum.qt.io/post/167645</link><guid isPermaLink="true">https://forum.qt.io/post/167645</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 18 Feb 2013 13:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila on Mon, 18 Feb 2013 12:56:50 GMT]]></title><description><![CDATA[<p dir="auto">desculpe, passei o link errado...<br />
<a href="http://www.4shared.com/rar/0N4xR644/BalancaGF.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.4shared.com/rar/0N4xR644/BalancaGF.html</a></p>
]]></description><link>https://forum.qt.io/post/167635</link><guid isPermaLink="true">https://forum.qt.io/post/167635</guid><dc:creator><![CDATA[Rodrigocg]]></dc:creator><pubDate>Mon, 18 Feb 2013 12:56:50 GMT</pubDate></item><item><title><![CDATA[Reply to Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila on Mon, 18 Feb 2013 12:04:01 GMT]]></title><description><![CDATA[<p dir="auto">Ola, Rodrigocg, acho que voce se enganou, o link que passou só tem um programa ja compilado e sem o txt que tu menciona</p>
]]></description><link>https://forum.qt.io/post/167625</link><guid isPermaLink="true">https://forum.qt.io/post/167625</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 18 Feb 2013 12:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to Duvidas ao usar subproject, projeto compila mas quando um faz referencia a outro não compila on Fri, 15 Feb 2013 22:18:56 GMT]]></title><description><![CDATA[<p dir="auto">da uma olhada nesse projeto:</p>
<p dir="auto"><a href="http://www.4shared.com/rar/ZzZ_fY8W/balanca.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.4shared.com/rar/ZzZ_fY8W/balanca.html</a></p>
<p dir="auto">antes de compilar veja o arquivo: "leia antes de compilar.txt"</p>
<p dir="auto">qualquer coisa pergunta...</p>
]]></description><link>https://forum.qt.io/post/167417</link><guid isPermaLink="true">https://forum.qt.io/post/167417</guid><dc:creator><![CDATA[Rodrigocg]]></dc:creator><pubDate>Fri, 15 Feb 2013 22:18:56 GMT</pubDate></item></channel></rss>