Project

General

Profile

Actions

Support #6904

closed

Run Dbo with Wt-4.0.5

Added by Karl Estermann about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/14/2019
Due date:
% Done:

0%

Estimated time:

Description

Hello,

i'm trying to get the tutorial9 to work under wt4. But that doesn't work. Does anyone have an example with Dbo under Wt4?

[ 20%] Building CXX object CMakeFiles/dbo-tutorial9.dir/main.C.o

/Users/karlestermann/CLionProjects/wt/examples/feature/dbo/tutorial9/main.C:7:10: fatal error: 'Wt/Dbo/Dbo.h' file not found

#include <Wt/Dbo/Dbo.h>

~

1 error generated.

gmake[3]: * [CMakeFiles/dbo-tutorial9.dir/build.make:63: CMakeFiles/dbo-tutorial9.dir/main.C.o] Error 1

gmake[2]: * [CMakeFiles/Makefile2:73: CMakeFiles/dbo-tutorial9.dir/all] Error 2

gmake[1]: * [CMakeFiles/Makefile2:85: CMakeFiles/dbo-tutorial9.dir/rule] Error 2

gmake: * [Makefile:118: dbo-tutorial9] Error 2


Files

arduino-arduinoide.desktop (367 Bytes) arduino-arduinoide.desktop Manuel Bonaparte, 02/25/2019 09:50 PM
Actions #1

Updated by Roel Standaert about 5 years ago

Can you outline the steps you're using to compile it? If you are doing it properly, it should find <Wt/Dbo/Dbo.h>.

Actions #2

Updated by Roel Standaert about 5 years ago

  • Status changed from New to Feedback
Actions #3

Updated by Karl Estermann about 5 years ago

-lwthttp -lwt -I /usr/local/include -L /usr/local/lib -j4

Actions #4

Updated by Karl Estermann about 5 years ago

make -lwthttp -lwt -I /usr/local/include -L /usr/local/lib -j4

Actions #5

Updated by Karl Estermann about 5 years ago

cmake -lwthttp -lwt -I /usr/local/include -L /usr/local/lib -j4

and

cmake_minimum_required(VERSION 2.8)

SET (tutorial_libs ${EXAMPLES_DBO_LIBS})

#IF (MULTI_THREADED)

  1. SET (tutorial_libs ${tutorial_libs} ${BOOST_THREAD_LIB})
    #ENDIF (MULTI_THREADED)

ADD_EXECUTABLE(dbo-tutorial9 main.C Membership.C Organisation.C Person.C)

TARGET_LINK_LIBRARIES(dbo-tutorial9 ${tutorial_libs})

INCLUDE_DIRECTORIES(${WT_SOURCE_DIR}/src

)

#[[

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

FIND_PACKAGE( Wt REQUIRED )

#

INCLUDE_DIRECTORIES(

${WT_SOURCE_DIR}/src

${Wt_INCLUDE_DIR}

)

]]

IF (MSVC)

SET_TARGET_PROPERTIES(dbo-tutorial9 PROPERTIES FOLDER "dbo/examples")

ENDIF (MSVC)

IF (INSTALL_EXAMPLES)

INSTALL (TARGETS dbo-tutorial9
DESTINATION ${CMAKE_INSTALL_PREFIX}/${EXAMPLES_DESTINATION}/feature/dbo/)

ENDIF (INSTALL_EXAMPLES)

Actions #6

Updated by Roel Standaert about 5 years ago

So you are using cmake on only that CMakeLists.txt that's in the tutorial9 directory? That's not a standalone CMakeLists.txt. Only the CMakeLists.txt in the root directory of the Wt source tree, and the CMakeLists.txt in the examples directory can be used standalone.

Actions #7

Updated by Karl Estermann about 5 years ago

Thanks for the Information but now I have a link problem:

"vtable for Wt::Dbo::MetaDboBase", referenced from:

Wt::Dbo::MetaDboBase::MetaDboBase(int, int, Wt::Dbo::Session*) in mainDbo.C.o

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

"vtable for Wt::Dbo::Impl::ParameterBase", referenced from:

Wt::Dbo::Impl::ParameterBase::ParameterBase() in mainDbo.C.o

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

"vtable for Wt::Dbo::ptr_base", referenced from:

Wt::Dbo::ptr_base::ptr_base() in mainDbo.C.o

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

gmake[3]: * [CMakeFiles/tuttorial9.dir/build.make:144: tuttorial9] Error 1

gmake[2]: * [CMakeFiles/Makefile2:73: CMakeFiles/tuttorial9.dir/all] Error 2

gmake[1]: * [CMakeFiles/Makefile2:85: CMakeFiles/tuttorial9.dir/rule] Error 2

gmake: * [Makefile:118: tuttorial9] Error 2

Actions #8

Updated by Manuel Bonaparte about 5 years ago

Karl Estermann wrote:

Hello,

i'm trying to get the tutorial9 to work under wt4. But that doesn't work. Does anyone have an example with Dbo under Wt4?

[ 20%] Building CXX object CMakeFiles/dbo-tutorial9.dir/main.C.o

/Users/karlestermann/CLionProjects/wt/examples/feature/dbo/tutorial9/main.C:7:10: fatal error: 'Wt/Dbo/Dbo.h' file not found

#include <Wt/Dbo/Dbo.h>

~

1 error generated.

gmake[3]: * [CMakeFiles/dbo-tutorial9.dir/build.make:63: CMakeFiles/dbo-tutorial9.dir/main.C.o] Error 1

gmake[2]: * [CMakeFiles/Makefile2:73: CMakeFiles/dbo-tutorial9.dir/all] Error 2

gmake[1]: * [CMakeFiles/Makefile2:85: CMakeFiles/dbo-tutorial9.dir/rule] Error 2

gmake: * [Makefile:118: dbo-tutorial9] Error 2

It seems you use Clion IDE.

I'm using Dbo from Wt-4.0.5 with not linking issues on Linux.

Assuming you have an expected Witty installation:

myApp main

#include <Wt/Dbo/Exception.h>
#include <Wt/Dbo/backend/Postgres.h> // PostgreSQL backend

int main()
{
    try
    {
       some_dbo_function();

    }catch(const Wt::Dbo::Exception &x){
        std::cerr << "Dbo exception " << x.what() << std::endl;

}

CMakeLists.txt

cmake_minimum_required(VERSION 3.7)
project(myapp)

set(CMAKE_CXX_STANDARD 14)

set(SOURCE_FILES myapp.cxx )

link_directories(/usr/local/lib)
add_executable(myapp ${SOURCE_FILES})

target_link_libraries(myapp  wt wtdbo wtdbopostgres)
Actions #9

Updated by Manuel Bonaparte about 5 years ago

#include <Wt/Dbo/Exception.h>
#include <Wt/Dbo/backend/Postgres.h> // PostgreSQL backend

int main()
{
    try
    {
       some_dbo_function();

    }catch(const Wt::Dbo::Exception &x){
        std::cerr << "Dbo exception " << x.what() << std::endl;
    }

   return 0;

}
Actions #10

Updated by Karl Estermann about 5 years ago

Thanks for help, if I run CMakeLists.txt from wt Projekt and then run CMakeLists.txt from Tutorial9 project

Actions #11

Updated by Roel Standaert over 4 years ago

  • Status changed from Feedback to Closed

I'm not sure if this means you managed to solve your issue? Feel free to reply if you're still having issues, but I'm closing this because it's an old issue.

Actions

Also available in: Atom PDF