copy class cpp and header to folder, its not visible by compiler
-
wrote 6 days ago last edited by
I have app linked to shared library
CTE (App) to CTL (Lib)I want to add new Class to shared Library which can be accessible in app, linked to the .so
When I create new Class with Qt Creator it works and builds and runs fine
If I just copy txt file to folder, its not visible by compiler
What do I miss? Maybe I should affect Makefile or smth else?TEMPLATE = app
CONFIG += c++17
CONFIG -= app_bundle
CONFIG -= qtLIBS += -L/home/j/CTL-Debug/debug/debug -lCtl
INCLUDEPATH += /home/j/CTL/QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas -w
QMAKE_CXXFLAGS += -Wno-ignored-qualifiersQMAKE_CXXFLAGS += -O0 -g
SOURCES +=
main.cpp
LibraryCTL.cppHEADERS +=
LibraryCTL.hmain.cpp
#include </home/j/CTL/LibraryCTL.h>TestFn test;
int main(int argc, char *argv[])
{return 0;
}LibraryCTL.h
#pragma once
#ifndef LIBRARYCTE_H
#define LIBRARYCTE_Husing namespace std;
#include <string>class LibraryCTE
{
public:
LibraryCTE();
~LibraryCTE();
};#endif
LibraryCTL.cpp
#include </home/j/CTE/LibraryCTL.h>LibraryCTE::LibraryCTE()
{}
LibraryCTE::~LibraryCTE()
{}
TEMPLATE = lib
CONFIG += c++17
CONFIG -= app_bundle
CONFIG -= qtDESTDIR = debug
TARGET = $$DESTDIR/CtlSOURCES +=
TestFn.cpp
LibraryCTL.cppHEADERS +=
TestFn.h
LibraryCTL.h#include <LibraryCTL.h>
LibraryCTL::LibraryCTL()
{}
LibraryCTL::~LibraryCTL()
{}
#pragma once
#ifndef LIBRARYCTL_H
#define LIBRARYCTL_H
#include <TestFn.h>
using namespace std;
#include <string>class LibraryCTL
{
public:
LibraryCTL();
~LibraryCTL();
};#endif
#include <LibraryCTL.h>
TestFn::TestFn(){
}#ifndef TESTFN_H
#define TESTFN_H
using namespace std;
#include <string>
class TestFn
{
public:
TestFn();
~TestFn();
};#endif
-
wrote 6 days ago last edited by
(I think it might be problem with Qt.pro file and empty/invisible/bad symbols or something like that)
I dont believe it related to Makefile or I can't find any other settings/system files related to building processSo I think problem must be in .pro file
-
I have app linked to shared library
CTE (App) to CTL (Lib)I want to add new Class to shared Library which can be accessible in app, linked to the .so
When I create new Class with Qt Creator it works and builds and runs fine
If I just copy txt file to folder, its not visible by compiler
What do I miss? Maybe I should affect Makefile or smth else?TEMPLATE = app
CONFIG += c++17
CONFIG -= app_bundle
CONFIG -= qtLIBS += -L/home/j/CTL-Debug/debug/debug -lCtl
INCLUDEPATH += /home/j/CTL/QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas -w
QMAKE_CXXFLAGS += -Wno-ignored-qualifiersQMAKE_CXXFLAGS += -O0 -g
SOURCES +=
main.cpp
LibraryCTL.cppHEADERS +=
LibraryCTL.hmain.cpp
#include </home/j/CTL/LibraryCTL.h>TestFn test;
int main(int argc, char *argv[])
{return 0;
}LibraryCTL.h
#pragma once
#ifndef LIBRARYCTE_H
#define LIBRARYCTE_Husing namespace std;
#include <string>class LibraryCTE
{
public:
LibraryCTE();
~LibraryCTE();
};#endif
LibraryCTL.cpp
#include </home/j/CTE/LibraryCTL.h>LibraryCTE::LibraryCTE()
{}
LibraryCTE::~LibraryCTE()
{}
TEMPLATE = lib
CONFIG += c++17
CONFIG -= app_bundle
CONFIG -= qtDESTDIR = debug
TARGET = $$DESTDIR/CtlSOURCES +=
TestFn.cpp
LibraryCTL.cppHEADERS +=
TestFn.h
LibraryCTL.h#include <LibraryCTL.h>
LibraryCTL::LibraryCTL()
{}
LibraryCTL::~LibraryCTL()
{}
#pragma once
#ifndef LIBRARYCTL_H
#define LIBRARYCTL_H
#include <TestFn.h>
using namespace std;
#include <string>class LibraryCTL
{
public:
LibraryCTL();
~LibraryCTL();
};#endif
#include <LibraryCTL.h>
TestFn::TestFn(){
}#ifndef TESTFN_H
#define TESTFN_H
using namespace std;
#include <string>
class TestFn
{
public:
TestFn();
~TestFn();
};#endif
@JacobNovitsky said in copy class cpp and header to folder, its not visible by compiler:
If I just copy txt file to folder, its not visible by compiler
What txt file and what folder?
You need to add header/cpp files in the pro file, else the build system knows nothing about these files.
https://doc.qt.io/qt-6/qmake-project-files.html#declaring-other-librariesAnd please format your code properly.
-
wrote 5 days ago last edited by
problem caused by invisible symbols in cpp file :) thanks for reply
-
1/4