Project

General

Profile

Problem in building a simple project.

Added by Anonymous over 11 years ago

Hi all.

I coded my first simple project in Wt and used CMake to (successfully) create the build files for my app on MSVC. When I built the BUILD_ALL project, i got the fooloing error message:

C:\Program Files\WT\include\Wt/WApplication(22) : fatal error C1083: Cannot open include file: 'boost/any.hpp': No such file or directory

It's clear that WT can't find the boost installation directory, even if I absolutely followed the WT installation steps you provided here.

So, is there a way to update Wt build/installation with the Boost installation directory without reistall it from scratch?


Replies (7)

RE: Problem in building a simple project. - Added by Anonymous over 11 years ago

Kapoios Kapou wrote:

Hi all.

I coded my first simple project in Wt and used CMake to (successfully) create the build files for my app on MSVC. When I built the BUILD_ALL project, i got the fooloing error message:

> C:Program FilesWTincludeWt/WApplication(22) : fatal error C1083: Cannot open include file: 'boost/any.hpp': No such file or directory

It's clear that WT can't find the boost installation directory, even if I absolutely followed the WT installation steps you provided here.

So, is there a way to update Wt build/installation with the Boost installation directory without reistall it from scratch?

Update:

Appended CMakeCache and Install_manifest from my Wt build directory, if it helps.

RE: Problem in building a simple project. - Added by Wim Dumon over 11 years ago

Hello Kapoios,

That explanation doesn't really cover the use of cmake in your own projects - it is up to you to decide what method you want to use for your application. This can be a plain msvs solution, or you may choose to use cmake to generate on for you, like Wt does.

In your own CMakeLists.txt, you'll have to refer to wt, as well as the boost directories (and possibly all other dependencies of Wt (zlib, haru, ...), depending on how you have built it). As an example, a typical CMakeLists.txt for a Wt project looks like this:

SET(WT_INSTALL_DIR "....")
SET(BOOST_INSTALL_DIR "....")

ADD_EXECUTABLE(
  MyExec.wt
  main.cpp
  file1.cpp
  file2.cpp
)

# The names of the Wt libraries. See cmake manual for syntax: the
# 'debug' and 'optimized' tell what names to use for non-debug and
# debug builds. On MSVS, this is important to get right for runtime
# library compatibility reasons.
SET(WT_LIBS
  optimized wthttp debug wthttpd
  optimized wt debug wtd)
# maybe you're using DBO?
#SET(WT_DBO_LIBS
#  optimized wtdbo debug wtdbod
#  optimized wtdbopostgres debug wtdbopostgresd)

# Usually there's no need to set BOOST_LIBS on windows; auto-linking is used.
# The libraries as listed below is a bit naive; the names tend to be more
# complex, and especially on windows, you'll have to specify the optimized/debug
# builds separately (as done above for Wt). The libraries as listed below may
# work on Linux. If not, consider using cmake's FindBoost method
SET(BOOST_LIBS
  boost_signals boost_regex boost_thread boost_filesystem boost_system
  boost_random boost_date_time boost_program_options)

# tell cmake what it should link your executable to
TARGET_LINK_LIBRARIES (
  MyExec.wt
  ${WT_LIBS} ${BOOST_LIBS} ${SYSTEM_LIBS} ${POSTGRES_LIBS}
)

# tell the linker where all these libraries should be searched for
LINK_DIRECTORIES (
  ${WT_INSTALL_DIR}/lib/
  ${BOOST_INSTALL_DIR}/lib/
)

# tell the compiler where it should look for extra include files
INCLUDE_DIRECTORIES(${WT_INSTALL_DIR}/include)
INCLUDE_DIRECTORIES(${BOOST_INSTALL_DIR}/include)

Regards,

Wim.

RE: Problem in building a simple project. - Added by Anonymous over 11 years ago

Wim, thank you for your response. But the previous error persists...

I changed my CMakeLists.txt which is placed on source files directory as:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET (WT_INSTALL_DIR \"C:/Program Files/WT/boost_1_47\")

SET (BOOST_INSTALL_DIR \"C:/Program Files/boost\")

ADD_EXECUTABLE(

GOP.wt

Main.C

)

# The names of the Wt libraries. See cmake manual for syntax: the

# 'debug' and 'optimized' tell what names to use for non-debug and

# debug builds. On MSVS, this is important to get right for runtime

# library compatibility reasons.

SET (WT_LIBS
optimized wthttp debug wthttpd
optimized wt debug wtd)

# maybe you're using DBO?

#SET (WT_DBO_LIBS
# optimized wtdbo debug wtdbod
# optimized wtdbopostgres debug wtdbopostgresd)

# Usually there's no need to set BOOST_LIBS on windows; auto-linking is used.

# The libraries as listed below is a bit naive; the names tend to be more

# complex, and especially on windows, you'll have to specify the optimized/debug

# builds separately (as done above for Wt). The libraries as listed below may

# work on Linux. If not, consider using cmake's FindBoost method

SET (BOOST_LIBS
boost_signals boost_regex boost_thread boost_filesystem boost_system
boost_random boost_date_time boost_program_options)

# tell cmake what it should link your executable to

TARGET_LINK_LIBRARIES (

GOP.wt

${WT_LIBS} ${BOOST_LIBS} ${SYSTEM_LIBS}

)

# tell the linker where all these libraries should be searched for

LINK_DIRECTORIES (

${WT_INSTALL_DIR}/lib/

${BOOST_INSTALL_DIR}/lib/

)

# tell the compiler where it should look for extra include files

INCLUDE_DIRECTORIES(${WT_INSTALL_DIR}/include)

INCLUDE_DIRECTORIES(${BOOST_INSTALL_DIR}/include)

CMakeLists.txt placed on project directory (which contains source files directory as a subdirectory) has the following contents:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT (WT_EXAMPLE)

SET (WT_CONNECTOR "wthttp" CACHE STRING "Connector used (wthttp or wtfcgi)")

ADD_SUBDIRECTORY(source)

I rebuild with CMake after changing the CMakeLists (on source dir) contents.

For further help from my side, CMakeCache and CMakeOutput from my project directory are appended to this post.

RE: Problem in building a simple project. - Added by Anonymous over 11 years ago

Forgot to say that Any.hpp is placed on C:\Program Files\boost\boost_1_47\boost\spirit\home\support\algorithm\any.hpp. I use boost v. 1.47 and Wt v. 3.2.2. Both were installed without any errors and the simple project examples were ran sucessfully.

I suspect that there's a concept with the path that Wt/WApplication searches boost/any.hpp. How can I fix it?

RE: Problem in building a simple project. - Added by Wim Dumon over 11 years ago

Verify your INCLUDE_DIRECTORIES statements in your CMakeLists.txt. I bet there's also an any.hpp in C:\Program Files\boost\boost_1_47\boost\

RE: Problem in building a simple project. - Added by Anonymous over 11 years ago

You were right. I managed to solve it by reinstalling boost and set the correct path to boost (it also needed to change the order of cmakelists commands).

But another problem occured now. When I tried to built my project I got a "LNK1104: cannot open file 'boost_signals.lib'" error.

By doing a research on this, I found that I need to build the boost-signals lib for my compiler (MSVC 2008 prof). Then, I saw that a boost_signals-vc90-mt-gd-1_47.lib file exists on {BOOST-INSTALL-DIR}/lib directory so I supposed that it's the builded version of boost-signals.hpp for my compiler.

I should mention that I used installer to install boost 1.47 to my system.

RE: Problem in building a simple project. - Added by Anonymous over 11 years ago

Ok, forget about that, I fixed it by changing lib names from boost*"whatever" to boost*"whatever"-vc90-mt-gd-1_47 in CMakeLists and rebuilt...

    (1-7/7)