Il 02/07/2018 08:44, Öö Tiib ha scritto:
> On Sunday, 1 July 2018 01:18:50 UTC+3, Soviet_Mario wrote:
>> I left C++ quite some years ago and now that I'm beginning
>> again (QT Creator IDE) I can no longer have control over
>> scope among files.
>>
>> I was used to separate code in different files, but it seems
>> that I have some wrong setting (maybe in the makefile
>> self-generated by QT, the errors are on linking)
>>
>> I've tried to include the .CPP files besides the normal .H
>> files (with the normal protection against multiple
>> inclusion, #ifndef #define #endif) but this still does not work.
>
> Qt is framework where we have to use (somewhat crippling) extension of
> C++ that the framework preprocesses into actual C++. It is done by utility
> called qmake. You need to indicate to qmake what files are in your project
> with a .pro file. I take random one from my hard drive:
In another strictly related thread I pasted the .pro file
uh I forgot the PROJECT file (generated by QT Creator)
#-------------------------------------------------
#
# Project created by QtCreator 2018-06-21T16:21:34
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Prova_QT_00
TEMPLATE = app
SOURCES +=\
main.cpp \
mainwindow.cpp \
disk_scanner_07.cpp
HEADERS += mainwindow.h \
disk_scanner_05.h
FORMS += mainwindow.ui
it seems to contain everything, nevertheless the errors :\
>
> #-------------------------------------------------
> #
> # Project created by QtCreator 2014-11-20T06:42:24
> #
> #-------------------------------------------------
>
> QT += core
>
> QT -= gui
>
>
> TARGET = MasterMind
> CONFIG += console
> CONFIG += c++11
> CONFIG -= app_bundle
>
> QMAKE_CXXFLAGS += -ftemplate-depth-5000 -fconstexpr-depth=5000
>
> QMAKE_LFLAGS += -Wl,--stack,4194304
>
> TEMPLATE = app
>
> SOURCES += main.cpp \
> Pattern.cpp
>
> HEADERS += \
> Peg.h \
> Pattern.h
this .pro files has some more options.
I did not write mine manually, it was autogenerated
>
> The point is to illustrate how one defines to qmake what .cpp and .h
> files are in a little project. So if you want to #include .cpp
> files then you should perhaps list those as HEADERS.
well actually I'm including just as headers.
Maybe I make mistakes writing the header itself.
>
> I did compare constexpr doing lot of things compile-time versus highly
> recursive code and so the QMAKE_CXXFLAGS and QMAKE_LFLAGS were altered
> for to allow unusual template, constexpr and stack depths, you likely
> don't need those settings. BTW I was convinced that constexpr works
> with Qt and is indeed a killer winner in runtime perfomance but causes
> horrible compile-times. ;)
>
> Better answers you will get in some Qt-related forums. Qt is compiling
> something that is not actually standard C++ and so is not strictly
> topical here.
well I'm not comfortable with forums out there :\