本文介绍了如何将Wt安装到自定义文件夹中而不会出现“致命错误:Wt/WApplication:没有这样的文件或目录"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Wt和c ++的新手,我刚刚在Ubuntu 16.04 LTS上将Wt Webframework安装到了主目录中的自定义文件夹中.我无法在此计算机的/usr目录中安装或构建任何软件.即使可以, PPA 在2 1//2年后,Ubuntu的官方安装说明也已过时. Aptitude不再随Ubuntu一起提供,最终将停产.

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.

我成功地编译并安装了所有内容,但是当我尝试编译 Hello World 示例出现以下错误:

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

这是我的安装步骤:

提升:

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

由于我将所有内容都集中在/myfolder中,因此在Wt安装中我没有使用/build文件夹说明. libwtlibboost库位于/myfolder/lib中.我以为所有链接都在安装过程中得到了解决.

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.

推荐答案

您必须告诉编译器在正确的文件夹中查找包含和库,所以不要:

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

尝试:

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

请注意,在运行应用程序时,还必须确保它可以找到所需的动态库(.so文件).您可以这样做:

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"

这篇关于如何将Wt安装到自定义文件夹中而不会出现“致命错误:Wt/WApplication:没有这样的文件或目录"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 22:55