2

I'm new to Wt and c++ and I just installed the Wt webframework on Ubuntu 16.04 LTS into a custom folder in my home directory. I cannot install or build any software into the /usr diretories of this computer. Even if I could, the PPA hasn't been active for 2 1/2 years, and the official Ubuntu installation instructions are also outdated. Aptitude no longer ships with Ubuntu and will eventually be discontinued.

I compliled and installed everything successfully, yet when I try to compile the Hello World example I get the following error:

g++ -o hello hello.cpp -lwt -lwthttp

fatal error: Wt/WApplication: No such file or directory

Here are my installation steps:

Boost:

wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.bz2
tar --bzip2 -xf boost_1_65_1.tar.bz2
cd boost_1_65_1
./bootstrap.sh --prefix=../myfolder
sudo ./b2 install --prefix=../myfolder

CMake:

wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar -xvzf cmake-3.9.2.tar.gz
cd cmake-3.9.2
./configure --prefix=../myfolder
make
sudo make install
vim .profile
export PATH=$PATH:/home/ubuntu/myfolder/bin

Wt:

git clone https://github.com/emweb/wt.git
cd wt
cmake -DCMAKE_INSTALL_PREFIX:PATH=../myfolder .
-- Generating done
-- Build files have been written to: /home/ubuntu/myfolder
make
sudo make install
make -C examples

Since I'm lumping everything together in /myfolder I did not use the /build folder per the Wt installation instructions. The libwt and libboost libraries are in /myfolder/lib. I assumed all of the linking was taken care of during installation.

Any thoughts? Thanks in advance.

  • 1
    You need to tell the compiler where to find the headers (i.e. set proper include paths, since you didn't install into the standard locations). – Dan Mašek Sep 09 '17 at 18:40

1 Answers1

0

You have to tell your compiler to look for includes and libraries in the right folders, so instead of:

g++ -o hello hello.cpp -lwt -lwthttp

Try:

g++ -o hello hello.cpp -I/home/ubuntu/myfolder/include -L/home/ubuntu/myfolder/lib -lwt -lwthttp

Note that when you run your application, you'll also have to make sure that it can find the dynamic libs (.so files) it needs. You could do this:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/ubuntu/myfolder/lib"
RockinRoel
  • 308
  • 1
  • 8
  • Thanks for the solution. I got it working now. I'm still struggling with Wt but I'm sure it's because of my inexperience with C++. It's going to take some time. Are you the same Roel that develops for Wt? Thanks again. –  Sep 13 '17 at 01:48
  • Yes, I'm the same Roel. I have a notification set on the wt tag for the few questions that get asked on StackOverflow instead of our Redmine. – RockinRoel Sep 13 '17 at 07:37
  • 1
    I installed the libraries with "sudo apt-get install witty witty-dev witty-doc witty-dbg witty-example" and I'm getting the same including fatal error. The compiler is right: in /usr/include/WT/ there is no WApplication.h file. The only .h files I see are WConfig, WDllDefs – jimifiki May 20 '18 at 18:01
  • Have the same issue as jimifiki, I'm on a Raspian virtual machine, I basically ran: g++ -o hello hello.cpp -I/usr/include -L/usr/lib -lwt -lwthttp because thats where I found the Wt files – mding5692 Nov 06 '18 at 20:45