How to Install Wt into a Custom Folder Without “fatal error: Wt/WApplication: No such file or directory”

不想你离开。 提交于 2019-12-11 02:22:21

问题


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 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"


来源:https://stackoverflow.com/questions/46133838/how-to-install-wt-into-a-custom-folder-without-fatal-error-wt-wapplication-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!