Qt Test: error symbol(s) not found when instantiating object in test project










1















I'm sure I'm just missing something in my original class (conferenceview), but I can't wrap my head around exactly what is missing. When I attempt to build my tst_conferencepage.cpp file, which includes my conferenceview class, I get an error message regarding symbol(s) not found for architecture x86_64 when I try to instantiate an object of type conferenceview.



conferenceview.h:



#ifndef CONFERENCEVIEW_H
#define CONFERENCEVIEW_H
#include "constants.h"

class conferenceView

QString conference; // Holds the current conference selected by the fan
QString division; // Holds the current division selected by the fan
public:
conferenceView(); // Default Constructor
void setConference(QString); // Sets the current conference of the fan
QString getConference(); // Returns the current conference of the fan
void setDivision(QString); // Sets the current division of the fan
QString getDivision(); // Gets the current division of the fan
QSqlQuery queryConference(QString); // Returns a query for the teams in a specified conference
QSqlQuery queryDivision(QString); // Returns a query for the teams in a specified conference
QSqlQueryModel* populateView(QString, int); // Returns a QSqlQueryModel index to display the queried data to the table view
;

#endif // CONFERENCEVIEW_H


conferenceview.cpp:



#include "conferenceview.h"

conferenceView::conferenceView()

this->conference = "";
this->division = "";


// Assigns conference to passed in QString
void conferenceView::setConference(QString conference) this->conference = conference;

// Returns conference
QString conferenceView::getConference() return this->conference; ;

// Assigns division to passed in QString
void conferenceView::setDivision(QString division) this->division = division;

// Returns division
QString conferenceView::getDivision() return this->division;


QSqlQuery conferenceView::queryConference(QString conference)

this->setConference(conference); // Sets current conference

// Queries database for team names by conference order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Conference = :conf "
"ORDER BY TeamName");
q.bindValue(":conf", conference);
q.exec();

return q;


QSqlQuery conferenceView::queryDivision(QString division)

// Sets current division
if( this->conference == "American Football Conference")
this->setDivision(division.prepend("AFC "));
else
this->setDivision(division.prepend("NFC "));

// Queries database for team names by division order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Division = :div "
"ORDER BY TeamName");
q.bindValue(":div", division);
q.exec();

return q;


QSqlQueryModel* conferenceView::populateView(QString str, int id)

QSqlQueryModel* qModel = new QSqlQueryModel;

// if id == 0, sets the qModel to the conference teams
if(id == 0)

this->setConference(str);
qModel->setQuery(this->queryConference(this->getConference()));

// if id == 1, sets the qModel to the division teams
else

this->setDivision(str);
qModel->setQuery(this->queryDivision(this->getDivision()));


// Sets the header title of the table view
qModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Team Name"));

return qModel;



tst_conferencepage.cpp:



#include <QtTest>
#include "../NFL_Teams_App/conferenceview.h"

class ConferencePage : public QObject

Q_OBJECT
QVector<QString> AFC;
public:
ConferencePage();
private slots:
void testAFCConference();
;

ConferencePage::ConferencePage()

this->AFC = "Baltimore Ravens", "Buffalo Bills", "Cincinnati Bengals",
"Cleveland Browns", "Denver Broncos", "Houston Texans",
"Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs",
"Los Angeles Chargers", "Miami Dolphins", "New England Patriots",
"New York Jets", "Oakland Raiders", "Pittsburgh Steelers", "Tennessee Titans";


void ConferencePage::testAFCConference()




 conferenceView c;
QSqlQuery query = c.queryConference("American Football Conference");
int index = 0;
while(query.next())
QVERIFY(this->AFC.at(index) == query.value(index));






The blocked code in ConferencePage::testAFCConference() is where I instantiate an object of type conferenceView and the errors stem from.



UnitTests.pro:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

SOURCES +=
tst_conferencepage.cpp


Project heirarchy:





Full error message:




Undefined symbols for architecture x86_64:

"conferenceView::queryConference(QString)", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o "conferenceView::conferenceView()", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation) make[1]:
* [UnitTests] Error 1 make: * [sub-UnitTests-make_first] Error 2 01:21:30: The process "/usr/bin/make" exited with code 2. Error while
building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2
clang 64bit) When executing step "Make"




Any help is appreciated, thank you in advance!










share|improve this question
























  • It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

    – Rhathin
    Nov 12 '18 at 9:42
















1















I'm sure I'm just missing something in my original class (conferenceview), but I can't wrap my head around exactly what is missing. When I attempt to build my tst_conferencepage.cpp file, which includes my conferenceview class, I get an error message regarding symbol(s) not found for architecture x86_64 when I try to instantiate an object of type conferenceview.



conferenceview.h:



#ifndef CONFERENCEVIEW_H
#define CONFERENCEVIEW_H
#include "constants.h"

class conferenceView

QString conference; // Holds the current conference selected by the fan
QString division; // Holds the current division selected by the fan
public:
conferenceView(); // Default Constructor
void setConference(QString); // Sets the current conference of the fan
QString getConference(); // Returns the current conference of the fan
void setDivision(QString); // Sets the current division of the fan
QString getDivision(); // Gets the current division of the fan
QSqlQuery queryConference(QString); // Returns a query for the teams in a specified conference
QSqlQuery queryDivision(QString); // Returns a query for the teams in a specified conference
QSqlQueryModel* populateView(QString, int); // Returns a QSqlQueryModel index to display the queried data to the table view
;

#endif // CONFERENCEVIEW_H


conferenceview.cpp:



#include "conferenceview.h"

conferenceView::conferenceView()

this->conference = "";
this->division = "";


// Assigns conference to passed in QString
void conferenceView::setConference(QString conference) this->conference = conference;

// Returns conference
QString conferenceView::getConference() return this->conference; ;

// Assigns division to passed in QString
void conferenceView::setDivision(QString division) this->division = division;

// Returns division
QString conferenceView::getDivision() return this->division;


QSqlQuery conferenceView::queryConference(QString conference)

this->setConference(conference); // Sets current conference

// Queries database for team names by conference order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Conference = :conf "
"ORDER BY TeamName");
q.bindValue(":conf", conference);
q.exec();

return q;


QSqlQuery conferenceView::queryDivision(QString division)

// Sets current division
if( this->conference == "American Football Conference")
this->setDivision(division.prepend("AFC "));
else
this->setDivision(division.prepend("NFC "));

// Queries database for team names by division order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Division = :div "
"ORDER BY TeamName");
q.bindValue(":div", division);
q.exec();

return q;


QSqlQueryModel* conferenceView::populateView(QString str, int id)

QSqlQueryModel* qModel = new QSqlQueryModel;

// if id == 0, sets the qModel to the conference teams
if(id == 0)

this->setConference(str);
qModel->setQuery(this->queryConference(this->getConference()));

// if id == 1, sets the qModel to the division teams
else

this->setDivision(str);
qModel->setQuery(this->queryDivision(this->getDivision()));


// Sets the header title of the table view
qModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Team Name"));

return qModel;



tst_conferencepage.cpp:



#include <QtTest>
#include "../NFL_Teams_App/conferenceview.h"

class ConferencePage : public QObject

Q_OBJECT
QVector<QString> AFC;
public:
ConferencePage();
private slots:
void testAFCConference();
;

ConferencePage::ConferencePage()

this->AFC = "Baltimore Ravens", "Buffalo Bills", "Cincinnati Bengals",
"Cleveland Browns", "Denver Broncos", "Houston Texans",
"Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs",
"Los Angeles Chargers", "Miami Dolphins", "New England Patriots",
"New York Jets", "Oakland Raiders", "Pittsburgh Steelers", "Tennessee Titans";


void ConferencePage::testAFCConference()




 conferenceView c;
QSqlQuery query = c.queryConference("American Football Conference");
int index = 0;
while(query.next())
QVERIFY(this->AFC.at(index) == query.value(index));






The blocked code in ConferencePage::testAFCConference() is where I instantiate an object of type conferenceView and the errors stem from.



UnitTests.pro:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

SOURCES +=
tst_conferencepage.cpp


Project heirarchy:





Full error message:




Undefined symbols for architecture x86_64:

"conferenceView::queryConference(QString)", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o "conferenceView::conferenceView()", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation) make[1]:
* [UnitTests] Error 1 make: * [sub-UnitTests-make_first] Error 2 01:21:30: The process "/usr/bin/make" exited with code 2. Error while
building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2
clang 64bit) When executing step "Make"




Any help is appreciated, thank you in advance!










share|improve this question
























  • It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

    – Rhathin
    Nov 12 '18 at 9:42














1












1








1








I'm sure I'm just missing something in my original class (conferenceview), but I can't wrap my head around exactly what is missing. When I attempt to build my tst_conferencepage.cpp file, which includes my conferenceview class, I get an error message regarding symbol(s) not found for architecture x86_64 when I try to instantiate an object of type conferenceview.



conferenceview.h:



#ifndef CONFERENCEVIEW_H
#define CONFERENCEVIEW_H
#include "constants.h"

class conferenceView

QString conference; // Holds the current conference selected by the fan
QString division; // Holds the current division selected by the fan
public:
conferenceView(); // Default Constructor
void setConference(QString); // Sets the current conference of the fan
QString getConference(); // Returns the current conference of the fan
void setDivision(QString); // Sets the current division of the fan
QString getDivision(); // Gets the current division of the fan
QSqlQuery queryConference(QString); // Returns a query for the teams in a specified conference
QSqlQuery queryDivision(QString); // Returns a query for the teams in a specified conference
QSqlQueryModel* populateView(QString, int); // Returns a QSqlQueryModel index to display the queried data to the table view
;

#endif // CONFERENCEVIEW_H


conferenceview.cpp:



#include "conferenceview.h"

conferenceView::conferenceView()

this->conference = "";
this->division = "";


// Assigns conference to passed in QString
void conferenceView::setConference(QString conference) this->conference = conference;

// Returns conference
QString conferenceView::getConference() return this->conference; ;

// Assigns division to passed in QString
void conferenceView::setDivision(QString division) this->division = division;

// Returns division
QString conferenceView::getDivision() return this->division;


QSqlQuery conferenceView::queryConference(QString conference)

this->setConference(conference); // Sets current conference

// Queries database for team names by conference order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Conference = :conf "
"ORDER BY TeamName");
q.bindValue(":conf", conference);
q.exec();

return q;


QSqlQuery conferenceView::queryDivision(QString division)

// Sets current division
if( this->conference == "American Football Conference")
this->setDivision(division.prepend("AFC "));
else
this->setDivision(division.prepend("NFC "));

// Queries database for team names by division order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Division = :div "
"ORDER BY TeamName");
q.bindValue(":div", division);
q.exec();

return q;


QSqlQueryModel* conferenceView::populateView(QString str, int id)

QSqlQueryModel* qModel = new QSqlQueryModel;

// if id == 0, sets the qModel to the conference teams
if(id == 0)

this->setConference(str);
qModel->setQuery(this->queryConference(this->getConference()));

// if id == 1, sets the qModel to the division teams
else

this->setDivision(str);
qModel->setQuery(this->queryDivision(this->getDivision()));


// Sets the header title of the table view
qModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Team Name"));

return qModel;



tst_conferencepage.cpp:



#include <QtTest>
#include "../NFL_Teams_App/conferenceview.h"

class ConferencePage : public QObject

Q_OBJECT
QVector<QString> AFC;
public:
ConferencePage();
private slots:
void testAFCConference();
;

ConferencePage::ConferencePage()

this->AFC = "Baltimore Ravens", "Buffalo Bills", "Cincinnati Bengals",
"Cleveland Browns", "Denver Broncos", "Houston Texans",
"Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs",
"Los Angeles Chargers", "Miami Dolphins", "New England Patriots",
"New York Jets", "Oakland Raiders", "Pittsburgh Steelers", "Tennessee Titans";


void ConferencePage::testAFCConference()




 conferenceView c;
QSqlQuery query = c.queryConference("American Football Conference");
int index = 0;
while(query.next())
QVERIFY(this->AFC.at(index) == query.value(index));






The blocked code in ConferencePage::testAFCConference() is where I instantiate an object of type conferenceView and the errors stem from.



UnitTests.pro:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

SOURCES +=
tst_conferencepage.cpp


Project heirarchy:





Full error message:




Undefined symbols for architecture x86_64:

"conferenceView::queryConference(QString)", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o "conferenceView::conferenceView()", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation) make[1]:
* [UnitTests] Error 1 make: * [sub-UnitTests-make_first] Error 2 01:21:30: The process "/usr/bin/make" exited with code 2. Error while
building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2
clang 64bit) When executing step "Make"




Any help is appreciated, thank you in advance!










share|improve this question
















I'm sure I'm just missing something in my original class (conferenceview), but I can't wrap my head around exactly what is missing. When I attempt to build my tst_conferencepage.cpp file, which includes my conferenceview class, I get an error message regarding symbol(s) not found for architecture x86_64 when I try to instantiate an object of type conferenceview.



conferenceview.h:



#ifndef CONFERENCEVIEW_H
#define CONFERENCEVIEW_H
#include "constants.h"

class conferenceView

QString conference; // Holds the current conference selected by the fan
QString division; // Holds the current division selected by the fan
public:
conferenceView(); // Default Constructor
void setConference(QString); // Sets the current conference of the fan
QString getConference(); // Returns the current conference of the fan
void setDivision(QString); // Sets the current division of the fan
QString getDivision(); // Gets the current division of the fan
QSqlQuery queryConference(QString); // Returns a query for the teams in a specified conference
QSqlQuery queryDivision(QString); // Returns a query for the teams in a specified conference
QSqlQueryModel* populateView(QString, int); // Returns a QSqlQueryModel index to display the queried data to the table view
;

#endif // CONFERENCEVIEW_H


conferenceview.cpp:



#include "conferenceview.h"

conferenceView::conferenceView()

this->conference = "";
this->division = "";


// Assigns conference to passed in QString
void conferenceView::setConference(QString conference) this->conference = conference;

// Returns conference
QString conferenceView::getConference() return this->conference; ;

// Assigns division to passed in QString
void conferenceView::setDivision(QString division) this->division = division;

// Returns division
QString conferenceView::getDivision() return this->division;


QSqlQuery conferenceView::queryConference(QString conference)

this->setConference(conference); // Sets current conference

// Queries database for team names by conference order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Conference = :conf "
"ORDER BY TeamName");
q.bindValue(":conf", conference);
q.exec();

return q;


QSqlQuery conferenceView::queryDivision(QString division)

// Sets current division
if( this->conference == "American Football Conference")
this->setDivision(division.prepend("AFC "));
else
this->setDivision(division.prepend("NFC "));

// Queries database for team names by division order by team name
QSqlQuery q;
q.prepare("SELECT TeamName "
"FROM TeamInfo "
"WHERE Division = :div "
"ORDER BY TeamName");
q.bindValue(":div", division);
q.exec();

return q;


QSqlQueryModel* conferenceView::populateView(QString str, int id)

QSqlQueryModel* qModel = new QSqlQueryModel;

// if id == 0, sets the qModel to the conference teams
if(id == 0)

this->setConference(str);
qModel->setQuery(this->queryConference(this->getConference()));

// if id == 1, sets the qModel to the division teams
else

this->setDivision(str);
qModel->setQuery(this->queryDivision(this->getDivision()));


// Sets the header title of the table view
qModel->setHeaderData(0, Qt::Horizontal, QObject::tr("Team Name"));

return qModel;



tst_conferencepage.cpp:



#include <QtTest>
#include "../NFL_Teams_App/conferenceview.h"

class ConferencePage : public QObject

Q_OBJECT
QVector<QString> AFC;
public:
ConferencePage();
private slots:
void testAFCConference();
;

ConferencePage::ConferencePage()

this->AFC = "Baltimore Ravens", "Buffalo Bills", "Cincinnati Bengals",
"Cleveland Browns", "Denver Broncos", "Houston Texans",
"Indianapolis Colts", "Jacksonville Jaguars", "Kansas City Chiefs",
"Los Angeles Chargers", "Miami Dolphins", "New England Patriots",
"New York Jets", "Oakland Raiders", "Pittsburgh Steelers", "Tennessee Titans";


void ConferencePage::testAFCConference()




 conferenceView c;
QSqlQuery query = c.queryConference("American Football Conference");
int index = 0;
while(query.next())
QVERIFY(this->AFC.at(index) == query.value(index));






The blocked code in ConferencePage::testAFCConference() is where I instantiate an object of type conferenceView and the errors stem from.



UnitTests.pro:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

SOURCES +=
tst_conferencepage.cpp


Project heirarchy:





Full error message:




Undefined symbols for architecture x86_64:

"conferenceView::queryConference(QString)", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o "conferenceView::conferenceView()", referenced from:
ConferencePage::testAFCConference() in tst_conferencepage.o ld: symbol(s) not found for architecture x86_64 clang: error: linker
command failed with exit code 1 (use -v to see invocation) make[1]:
* [UnitTests] Error 1 make: * [sub-UnitTests-make_first] Error 2 01:21:30: The process "/usr/bin/make" exited with code 2. Error while
building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2
clang 64bit) When executing step "Make"




Any help is appreciated, thank you in advance!







c++ qt qt-creator undefined-symbol qttest






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 9:44







mitchdotdev

















asked Nov 12 '18 at 8:56









mitchdotdevmitchdotdev

114




114












  • It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

    – Rhathin
    Nov 12 '18 at 9:42


















  • It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

    – Rhathin
    Nov 12 '18 at 9:42

















It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

– Rhathin
Nov 12 '18 at 9:42






It looks like you don't have specified conferenceview.cpp in your UnitTests.pro file. Can you show us body of your UnitTests.pro?

– Rhathin
Nov 12 '18 at 9:42













1 Answer
1






active

oldest

votes


















0














You're missing conferenceview.cpp and conferenceview.h in your UnitTest.pro file, so linker doesn't know, what your test should be build from. Your .pro file should looks like below:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

VPATH = "../NFL_Teams_App"

SOURCES +=
tst_conferencepage.cpp
conferenceview.cpp

HEADERS +=
conferenceview.h





share|improve this answer

























  • I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

    – mitchdotdev
    Nov 12 '18 at 9:53












  • @mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

    – Rhathin
    Nov 12 '18 at 10:00












  • It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

    – mitchdotdev
    Nov 12 '18 at 10:04










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258694%2fqt-test-error-symbols-not-found-when-instantiating-object-in-test-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You're missing conferenceview.cpp and conferenceview.h in your UnitTest.pro file, so linker doesn't know, what your test should be build from. Your .pro file should looks like below:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

VPATH = "../NFL_Teams_App"

SOURCES +=
tst_conferencepage.cpp
conferenceview.cpp

HEADERS +=
conferenceview.h





share|improve this answer

























  • I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

    – mitchdotdev
    Nov 12 '18 at 9:53












  • @mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

    – Rhathin
    Nov 12 '18 at 10:00












  • It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

    – mitchdotdev
    Nov 12 '18 at 10:04















0














You're missing conferenceview.cpp and conferenceview.h in your UnitTest.pro file, so linker doesn't know, what your test should be build from. Your .pro file should looks like below:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

VPATH = "../NFL_Teams_App"

SOURCES +=
tst_conferencepage.cpp
conferenceview.cpp

HEADERS +=
conferenceview.h





share|improve this answer

























  • I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

    – mitchdotdev
    Nov 12 '18 at 9:53












  • @mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

    – Rhathin
    Nov 12 '18 at 10:00












  • It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

    – mitchdotdev
    Nov 12 '18 at 10:04













0












0








0







You're missing conferenceview.cpp and conferenceview.h in your UnitTest.pro file, so linker doesn't know, what your test should be build from. Your .pro file should looks like below:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

VPATH = "../NFL_Teams_App"

SOURCES +=
tst_conferencepage.cpp
conferenceview.cpp

HEADERS +=
conferenceview.h





share|improve this answer















You're missing conferenceview.cpp and conferenceview.h in your UnitTest.pro file, so linker doesn't know, what your test should be build from. Your .pro file should looks like below:



QT += core testlib sql
QT -= gui

TARGET = UnitTests

CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle

TEMPLATE = app

VPATH = "../NFL_Teams_App"

SOURCES +=
tst_conferencepage.cpp
conferenceview.cpp

HEADERS +=
conferenceview.h






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 12 '18 at 9:59

























answered Nov 12 '18 at 9:47









RhathinRhathin

6362313




6362313












  • I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

    – mitchdotdev
    Nov 12 '18 at 9:53












  • @mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

    – Rhathin
    Nov 12 '18 at 10:00












  • It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

    – mitchdotdev
    Nov 12 '18 at 10:04

















  • I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

    – mitchdotdev
    Nov 12 '18 at 9:53












  • @mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

    – Rhathin
    Nov 12 '18 at 10:00












  • It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

    – mitchdotdev
    Nov 12 '18 at 10:04
















I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

– mitchdotdev
Nov 12 '18 at 9:53






I added those changes, however the new error message it gives me is: make[1]: *** No rule to make target conferenceview.cpp', needed by conferenceview.o'. Stop. make: *** [sub-UnitTests-make_first] Error 2 01:52:18: The process "/usr/bin/make" exited with code 2. Error while building/deploying project NFLTeamsProject (kit: Desktop Qt 5.11.2 clang 64bit) When executing step "Make"

– mitchdotdev
Nov 12 '18 at 9:53














@mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

– Rhathin
Nov 12 '18 at 10:00






@mitchdotdev, yes, sorry, I didn't take into account your project hierarchy. Please, check it now (I've added VPATH in your .pro)

– Rhathin
Nov 12 '18 at 10:00














It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

– mitchdotdev
Nov 12 '18 at 10:04





It works! I knew it was something related to how the files were included. It makes sense looking into the documentation regarding VPATH why that was necessary. I appreciate your help!

– mitchdotdev
Nov 12 '18 at 10:04

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258694%2fqt-test-error-symbols-not-found-when-instantiating-object-in-test-project%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kleinkühnau

Makov (Slowakei)

Deutsches Schauspielhaus