<?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[Qt: Global String Calling Issue]]></title><description><![CDATA[<p dir="auto">Ok i am new to QT and been playing around and watching tutorials but i having issues reverencing a string i want to make global,</p>
<p dir="auto">here is my .H</p>
<pre><code>#ifndef ELFENLIEDTOPFAN5RES_H
#define ELFENLIEDTOPFAN5RES_H
#include &lt;QString&gt;


class ELFENLIEDTOPFAN5RES
{
public:
ELFENLIEDTOPFAN5RES();
static QString BO3_Path;
};




#endif // ELFENLIEDTOPFAN5RES_H
</code></pre>
<p dir="auto">and here is the cpp</p>
<pre><code>#include "mainwindow.h"
#include "ui_mainwindow.h"
#include &lt;QMessageBox&gt;
#include &lt;QStatusBar&gt;
#include "elfenliedtopfan5Res.h"


ELFENLIEDTOPFAN5RES::ELFENLIEDTOPFAN5RES()
{
    ELFENLIEDTOPFAN5RES::BO3_Path = (QString(getenv("TA_GAME_PATH")).replace('\\', '/'));

}


MainWindow::MainWindow(QWidget *parent)

    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui-&gt;setupUi(this);

}


MainWindow::~MainWindow()
{

    delete ui;
    //const QString elfenliedtopfan5Res::BO3_PATH = (QString(getenv("TA_GAME_PATH")).replace('\\', '/'));
}



void MainWindow::on_pushButton_clicked()
{
    QString elfen2 = ELFENLIEDTOPFAN5RES::BO3_Path;
   QMessageBox::information(this,"title",elfen2);
}
</code></pre>
<p dir="auto">this is the error it throws,<br />
mainwindow.cpp:-1: error: undefined reference to `ELFENLIEDTOPFAN5RES::BO3_Path'</p>
<p dir="auto">but unsure of why its doing this i have tried multiple things and looked on loads of global string setups but still no avail<br />
sorry if its a noob question<br />
thank you for reading<br />
<strong>elfenliedtopfan5</strong></p>
]]></description><link>https://forum.qt.io/topic/120094/qt-global-string-calling-issue</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 22:35:49 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/120094.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Oct 2020 17:55:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt: Global String Calling Issue on Mon, 19 Oct 2020 17:58:53 GMT]]></title><description><![CDATA[<p dir="auto">Basic c++ - a static variable needs to be properly initialized. You only declared that there is a static variable but did not define it.</p>
]]></description><link>https://forum.qt.io/post/623009</link><guid isPermaLink="true">https://forum.qt.io/post/623009</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 19 Oct 2020 17:58:53 GMT</pubDate></item><item><title><![CDATA[Reply to Qt: Global String Calling Issue on Tue, 20 Oct 2020 23:24:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> Thank you sorry i am really new to QT and c++ is not my native language c# is so get little confused but than you for reply :)</p>
]]></description><link>https://forum.qt.io/post/623285</link><guid isPermaLink="true">https://forum.qt.io/post/623285</guid><dc:creator><![CDATA[elfenliedtopfan5]]></dc:creator><pubDate>Tue, 20 Oct 2020 23:24:49 GMT</pubDate></item><item><title><![CDATA[Reply to Qt: Global String Calling Issue on Mon, 19 Oct 2020 18:01:08 GMT]]></title><description><![CDATA[<p dir="auto">Hi and welcome to devnet,</p>
<p dir="auto">Move that line out of the constructor. Initializing a static class variable is not done there.</p>
<p dir="auto">By the way, Qt provides <a href="https://doc.qt.io/qt-5/qtglobal.html#qEnvironmentVariable" target="_blank" rel="noopener noreferrer nofollow ugc">functions to get environment variables</a>.</p>
]]></description><link>https://forum.qt.io/post/623011</link><guid isPermaLink="true">https://forum.qt.io/post/623011</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 19 Oct 2020 18:01:08 GMT</pubDate></item><item><title><![CDATA[Reply to Qt: Global String Calling Issue on Mon, 19 Oct 2020 17:58:53 GMT]]></title><description><![CDATA[<p dir="auto">Basic c++ - a static variable needs to be properly initialized. You only declared that there is a static variable but did not define it.</p>
]]></description><link>https://forum.qt.io/post/623009</link><guid isPermaLink="true">https://forum.qt.io/post/623009</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 19 Oct 2020 17:58:53 GMT</pubDate></item></channel></rss>