Project

General

Profile

How to link a Wt with project via cmake when Wt is built from source (MSVC2015)?

Added by Aleksey Anosov over 6 years ago

Hello! I am trying to link Wt library via cmake. I've already compiled Boost and Wt libraries like in tutorial. My CMakeLists.txt:

cmake_minimum_required( VERSION 2.8 )

project( Wt_cmake_test )

SET( CMAKE_MODULE_PATH "c:/Wt/wt-3.3.8/cmake" )

SET( CMAKE_BIULD_TYPE Debug )

FIND_PACKAGE( Wt REQUIRED )

INCLUDE_DIRECTORIES( ${Wt_INCLUDE_DIR} )

TARGET_LINK_LIBRARIES( ${PROjECT_NAME}

${Wt_DEBUG_LIBRARY} # or {Wt_LIBRARY}

${Wt_HTTP_DEBUG_LIBRARY} # or {Wt_HTTP_LIBRARY}

${Wt_EXT_DEBUG_LIBRARY} # or {Wt_EXT_LIBRARY}

)

add_executable(${PROJECT_NAME} "main.cpp")

I tryed to build project but got the error message:

Execution "C:\Program Files\CMake\bin\cmake.exe -E server "---pipe=\\.\pipe\{b727f4e5-83f8-4bc5-a1b2-f2965bf06c83}\" ---experimental\" in C:\Users\g_r_e\AppData\Local\Temp\QtCreator-l9Mfi9\qtc-cmake-XXUVjXAB.

CMake Error at C:/Wt/wt-3.3.8/cmake/FindWt.cmake:149 (MESSAGE):

Could NOT find Wt

Call Stack (most recent call first):

CMakeLists.txt:9 (FIND_PACKAGE)

Configuring incomplete, errors occurred!

What am I doing wrong? How to link it?


Replies (8)

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Wim Dumon over 6 years ago

Hey aleksey,

The FindWt module was contributed, personally I don't use it. It's possible that it does not work on Windows. I usually set Wt_INCLUDE_DIR and all the wt libraries manually.

In Wt 4, we use a newer method of generating the import modules, which should work on windows too.

Best regards,

Wim.

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Heiner Bensemer almost 4 years ago

I am running into problems too, i just did take the "Hello World" example from EmWeb-Homepage (https://www.webtoolkit.eu/wt/doc/tutorial/wt.html) to my Windows 7 PC, put it in Codelite IDE, using MinGW64 for compile.

I did add the path to wt (4.3.1 - 64bit) include and lib folders and add wt and wthttp to the linker libraries and set compiler option std=c++14.

Compileresult:

C:\WINDOWS\system32\cmd.exe /C C:/Dev/MinGW/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ HelloWitty - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Dev/workspaces/HelloWitty'
C:/Dev/MinGW/bin/g++.exe  -c  "C:/Dev/workspaces/HelloWitty/main.cpp" -g -O0 -std=c++14 -Wall -DDEBUG  -o ../build-Debug/HelloWitty/main.cpp.o -I. -I. -IC:\Dev\wt\4.3.1\include
C:/Dev/workspaces/HelloWitty/main.cpp:8:37: error: invalid use of incomplete type 'class Wt::WApplication'
    8 | class HelloApplication : public Wt::WApplication
      |                                     ^~~~~~~~~~~~
In file included from C:\Dev\wt\4.3.1\include/Wt/WString.h:11,
                 from C:\Dev\wt\4.3.1\include/Wt/WWebWidget.h:13,
                 from C:\Dev\wt\4.3.1\include/Wt/WBreak.h:10,
                 from C:/Dev/workspaces/HelloWitty/main.cpp:2:
C:\Dev\wt\4.3.1\include/Wt/WGlobal.h:57:9: note: forward declaration of 'class Wt::WApplication'
   57 |   class WApplication;
      |         ^~~~~~~~~~~~
C:/Dev/workspaces/HelloWitty/main.cpp: In constructor 'HelloApplication::HelloApplication(const Wt::WEnvironment&)':
C:/Dev/workspaces/HelloWitty/main.cpp:19:11: error: type 'Wt::WApplication' is not a direct base of 'HelloApplication'
   19 |     : Wt::WApplication(env)
      |           ^~~~~~~~~~~~
C:/Dev/workspaces/HelloWitty/main.cpp:21:5: error: 'setTitle' was not declared in this scope
   21 |     setTitle("Hello Witty-World");
      |     ^~~~~~~~
C:/Dev/workspaces/HelloWitty/main.cpp:23:5: error: 'root' was not declared in this scope
   23 |     root()->addWidget(std::make_unique<Wt::WText>("Your name, please? "));
      |     ^~~~
C:/Dev/workspaces/HelloWitty/main.cpp: In function 'int main(int, char**)':
C:/Dev/workspaces/HelloWitty/main.cpp:36:16: error: 'WRun' is not a member of 'Wt'
   36 |     return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
      |                ^~~~
mingw32-make.exe[1]: *** [../build-Debug/HelloWitty/main.cpp.o] Error 1
HelloWitty.mk:97: recipe for target '../build-Debug/HelloWitty/main.cpp.o' failed
mingw32-make.exe[1]: Leaving directory 'C:/Dev/workspaces/HelloWitty'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====6 errors, 1 warnings====

What is wrong?

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Heiner Bensemer almost 4 years ago

I just add to the main.cpp:

#include <Wt/WApplication.h>

These resolves error described before, but now i get these errors:

C:\WINDOWS\system32\cmd.exe /C C:/Dev/MinGW/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ HelloWitty - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Dev/workspaces/HelloWitty'
C:/Dev/MinGW/bin/g++.exe  -c  "C:/Dev/workspaces/HelloWitty/main.cpp" -g -O0 -std=c++14 -Wall -DDEBUG  -o ../build-Debug/HelloWitty/main.cpp.o -I. -I. -IC:\Dev\wt\4.3.1\include
C:/Dev/MinGW/bin/g++.exe -o ..\build-Debug\bin\HelloWitty @../build-Debug/HelloWitty/ObjectsList.txt -L. -LC:\Dev\wt\4.3.1\lib  -lwtd -lwthttpd
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `operator()':
C:/Dev/workspaces/HelloWitty/main.cpp:30: undefined reference to `_imp___ZN2WtplEPKcRKNS_7WStringE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:30: undefined reference to `_imp___ZN2Wt5WText7setTextERKNS_7WStringE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:30: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:30: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZN16HelloApplicationC2ERKN2Wt12WEnvironmentE':
C:/Dev/workspaces/HelloWitty/main.cpp:20: undefined reference to `_imp___ZN2Wt12WApplicationC2ERKNS_12WEnvironmentENS_12WtLibVersionE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:22: undefined reference to `_imp___ZN2Wt7WStringC1EPKcNS_12CharEncodingE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:22: undefined reference to `_imp___ZN2Wt12WApplication8setTitleERKNS_7WStringE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:22: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:32: undefined reference to `_imp___ZN2Wt15WInteractWidget7clickedEv'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:32: undefined reference to `_imp___ZN2Wt7Signals4Impl10ConnectionD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:22: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: C:/Dev/workspaces/HelloWitty/main.cpp:20: undefined reference to `_imp___ZN2Wt12WApplicationD2Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `main':
C:/Dev/workspaces/HelloWitty/main.cpp:37: undefined reference to `_imp___ZN2Wt4WRunEiPPcSt8functionIFSt10unique_ptrINS_12WApplicationESt14default_deleteIS4_EERKNS_12WEnvironmentEEE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `connect<HelloApplication::HelloApplication(const Wt::WEnvironment&)::<lambda()> >':
C:/Dev/wt/4.3.1/include/Wt/WSignal.h:809: undefined reference to `_imp___ZN2Wt15EventSignalBase12exposeSignalEv'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZSt11make_uniqueIN2Wt5WTextEJRA20_KcEENSt9_MakeUniqIT_E15__single_objectEDpOT0_':
c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringC1EPKcNS_12CharEncodingE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt5WTextC1ERKNS_7WStringE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZSt11make_uniqueIN2Wt9WLineEditEJEENSt9_MakeUniqIT_E15__single_objectEDpOT0_':
c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt9WLineEditC1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZSt11make_uniqueIN2Wt11WPushButtonEJRA10_KcEENSt9_MakeUniqIT_E15__single_objectEDpOT0_':
c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringC1EPKcNS_12CharEncodingE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt11WPushButtonC1ERKNS_7WStringE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt7WStringD1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZSt11make_uniqueIN2Wt6WBreakEJEENSt9_MakeUniqIT_E15__single_objectEDpOT0_':
c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt6WBreakC1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZSt11make_uniqueIN2Wt5WTextEJEENSt9_MakeUniqIT_E15__single_objectEDpOT0_':
c:/dev/mingw/lib/gcc/mingw32/9.2.0/include/c++/bits/unique_ptr.h:849: undefined reference to `_imp___ZN2Wt5WTextC1Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZN16HelloApplicationD1Ev':
C:/Dev/workspaces/HelloWitty/main.cpp:9: undefined reference to `_imp___ZN2Wt12WApplicationD2Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZN2Wt7Signals4Impl11ProtoSignalIJNS_11WMouseEventEEE10SignalLink10add_beforeEOSt8functionIFvS3_EEPKNS_4Core10observableE':
C:/Dev/wt/4.3.1/include/Wt/Signals/signals.hpp:147: undefined reference to `_imp___ZN2Wt7Signals4Impl14SignalLinkBase7connectEPKNS_4Core10observableE'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZN2Wt7Signals4Impl11ProtoSignalIJNS_11WMouseEventEEE10SignalLinkC1Ev':
C:/Dev/wt/4.3.1/include/Wt/Signals/signals.hpp:100: undefined reference to `_imp___ZN2Wt7Signals4Impl14SignalLinkBaseC2EPFvPS2_E'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o: in function `ZN2Wt7Signals4Impl11ProtoSignalIJNS_11WMouseEventEEE10SignalLinkD1Ev':
C:/Dev/wt/4.3.1/include/Wt/Signals/signals.hpp:105: undefined reference to `_imp___ZN2Wt7Signals4Impl14SignalLinkBaseD2Ev'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x10): undefined reference to `Wt::WObject::id[abi:cxx11]() const'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x14): undefined reference to `Wt::WObject::setObjectName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x18): undefined reference to `Wt::WObject::objectName[abi:cxx11]() const'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x1c): undefined reference to `Wt::WObject::signalConnectionsChanged()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x20): undefined reference to `Wt::WObject::setFormData(Wt::WObject::FormData const&)'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x24): undefined reference to `Wt::WObject::setRequestTooLarge(long long)'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x28): undefined reference to `Wt::WObject::getStateless(void (Wt::WObject::*)())'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x2c): undefined reference to `Wt::WApplication::refresh()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x30): undefined reference to `Wt::WApplication::makeAbsoluteUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x34): undefined reference to `Wt::WApplication::waitForEvent()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x38): undefined reference to `Wt::WApplication::initialize()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x3c): undefined reference to `Wt::WApplication::finalize()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x40): undefined reference to `Wt::WApplication::notify(Wt::WEvent const&)'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x44): undefined reference to `Wt::WApplication::isExposed(Wt::WWidget*) const'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x48): undefined reference to `Wt::WApplication::enableAjax()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x4c): undefined reference to `Wt::WApplication::unload()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x50): undefined reference to `Wt::WApplication::idleTimeout()'
c:/dev/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: ../build-Debug/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[__ZTV16HelloApplication]+0x54): undefined reference to `Wt::WApplication::handleJavaScriptError(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [..\build-Debug\bin\HelloWitty] Error 1
HelloWitty.mk:78: recipe for target '..\build-Debug\bin\HelloWitty' failed
mingw32-make.exe[1]: Leaving directory 'C:/Dev/workspaces/HelloWitty'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
====48 errors, 0 warnings====

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Heiner Bensemer almost 4 years ago

Ok sorry, in the posts before i did use mingw32 instead of mingw64, but now i tried again with ming64 and also did add the following includes:

#include <Wt/WEnvironment.h>

#include <Wt/WString.h>

Results still not ok:

C:\WINDOWS\system32\cmd.exe /C C:/Dev/MinGW64/bin/mingw32-make.exe -j8 SHELL=cmd.exe -e -f  Makefile
"----------Building project:[ HelloWitty - Release ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Dev/workspaces/HelloWitty'
C:/Dev/MinGW64/bin/g++.exe  -c  "C:/Dev/workspaces/HelloWitty/main.cpp" -O2 -std=c++17 -std=c++14 -Wall -std=c++1y -DNDEBUG  -o ../build-Release/HelloWitty/main.cpp.o -I. -I. -IC:\Dev\wt\4.3.1\include
C:/Dev/MinGW64/bin/g++.exe -o ..\build-Release\bin\HelloWitty @../build-Release/HelloWitty/ObjectsList.txt -L. -LC:\Dev\wt\4.3.1\lib  -lwt -lwthttp
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x114): undefined reference to `__imp__ZN2WtplEPKcRKNS_7WStringE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x12c): undefined reference to `__imp__ZN2Wt5WText7setTextERKNS_7WStringE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x137): undefined reference to `__imp__ZN2Wt7WStringD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x166): undefined reference to `__imp__ZN2Wt7WStringD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x215): undefined reference to `__imp__ZN2Wt12WApplicationC2ERKNS_12WEnvironmentENS_12WtLibVersionE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x22e): undefined reference to `__imp__ZN2Wt7WStringC1EPKcNS_12CharEncodingE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x279): undefined reference to `__imp__ZN2Wt12WApplication8setTitleERKNS_7WStringE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x280): undefined reference to `__imp__ZN2Wt7WStringD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x300): undefined reference to `__imp__ZN2Wt5WTextC1ERKNS_7WStringE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x392): undefined reference to `__imp__ZN2Wt9WLineEditC1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x44a): undefined reference to `__imp__ZN2Wt11WPushButtonC1ERKNS_7WStringE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x4dd): undefined reference to `__imp__ZN2Wt6WBreakC1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x563): undefined reference to `__imp__ZN2Wt5WTextC1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x5d1): undefined reference to `__imp__ZN2Wt15WInteractWidget7clickedEv'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x5ea): undefined reference to `__imp__ZN2Wt15EventSignalBase12exposeSignalEv'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x74b): undefined reference to `__imp__ZN2Wt7Signals4Impl14SignalLinkBaseC2EPFvPS2_E'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x809): undefined reference to `__imp__ZN2Wt7Signals4Impl14SignalLinkBase7connectEPKNS_4Core10observableE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x892): undefined reference to `__imp__ZN2Wt7Signals4Impl10ConnectionD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x8e1): undefined reference to `__imp__ZN2Wt7Signals4Impl14SignalLinkBaseC2EPFvPS2_E'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x9ea): undefined reference to `__imp__ZN2Wt7WStringD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0x9f8): undefined reference to `__imp__ZN2Wt12WApplicationD2Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text+0xa2a): undefined reference to `__imp__ZN2Wt7WStringD1Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text$_ZN16HelloApplicationD1Ev[_ZN16HelloApplicationD1Ev]+0xd): undefined reference to `__imp__ZN2Wt12WApplicationD2Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text$_ZN16HelloApplicationD0Ev[_ZN16HelloApplicationD0Ev]+0x14): undefined reference to `__imp__ZN2Wt12WApplicationD2Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text$_ZN2Wt7Signals4Impl11ProtoSignalIJNS_11WMouseEventEEE10SignalLink10unlinkBaseEPNS1_14SignalLinkBaseE[_ZN2Wt7Signals4Impl11ProtoSignalIJNS_11WMouseEventEEE10SignalLink10unlinkBaseEPNS1_14SignalLinkBaseE]+0xc5): undefined reference to `__imp__ZN2Wt7Signals4Impl14SignalLinkBaseD2Ev'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.text.startup+0xb1): undefined reference to `__imp__ZN2Wt4WRunEiPPcSt8functionIFSt10unique_ptrINS_12WApplicationESt14default_deleteIS4_EERKNS_12WEnvironmentEEE'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x20): undefined reference to `Wt::WObject::id[abi:cxx11]() const'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x28): undefined reference to `Wt::WObject::setObjectName(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x30): undefined reference to `Wt::WObject::objectName[abi:cxx11]() const'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x38): undefined reference to `Wt::WObject::signalConnectionsChanged()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x40): undefined reference to `Wt::WObject::setFormData(Wt::WObject::FormData const&)'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x48): undefined reference to `Wt::WObject::setRequestTooLarge(long long)'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x50): undefined reference to `Wt::WObject::getStateless(void (Wt::WObject::*)())'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x58): undefined reference to `Wt::WApplication::refresh()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x60): undefined reference to `Wt::WApplication::makeAbsoluteUrl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x68): undefined reference to `Wt::WApplication::waitForEvent()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x70): undefined reference to `Wt::WApplication::initialize()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x78): undefined reference to `Wt::WApplication::finalize()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x80): undefined reference to `Wt::WApplication::notify(Wt::WEvent const&)'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x88): undefined reference to `Wt::WApplication::isExposed(Wt::WWidget*) const'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x90): undefined reference to `Wt::WApplication::enableAjax()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0x98): undefined reference to `Wt::WApplication::unload()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0xa0): undefined reference to `Wt::WApplication::idleTimeout()'
../build-Release/HelloWitty/main.cpp.o:main.cpp:(.rdata$_ZTV16HelloApplication[_ZTV16HelloApplication]+0xa8): undefined reference to `Wt::WApplication::handleJavaScriptError(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[1]: *** [HelloWitty.mk:81: ..\build-Release\bin\HelloWitty] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Dev/workspaces/HelloWitty'
mingw32-make.exe: *** [Makefile:5: All] Error 2
====44 errors, 0 warnings====

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Heiner Bensemer almost 4 years ago

I did give it a try on CentOS7 Linux and wondering me, there is the same problem.....but i did find out, that here the problem is that i did use VCS (Visual Studio Code) as IDE for the first time and VCS did not handle the LD_LIBARY_PATH. The Solution is to parametrize your build configuration within tasks.json and at the needed path and libs to the args section like this:

            "args": [
......
                "-L.",
                "-L/usr/local/lib",
                "-lwtd",
                "-lwthttpd"

Hope, this will help someone:-) It is working for me now.

RE: How to link a Wt with project via cmake when Wt is built from source (MSVC2015)? - Added by Heiner Bensemer almost 4 years ago

One more hint - do not parametrize the environment like hat, it has no reflect for loading libs:

"environment": [{ "name": "LD_LIBRARY_PATH", "value": "/usr/local/lib" }],
    (1-8/8)