LiangliangNan / Easy3D

A lightweight, easy-to-use, and efficient C++ library for processing and rendering 3D data
GNU General Public License v3.0
1.35k stars 243 forks source link

Running first time #166

Closed bgpantojar closed 1 year ago

bgpantojar commented 1 year ago

Hello,

I am just starting to use Easy3D. I followed your instructions to build it from the source code and then I tried to compile one of the tutorial files provided but it did not work as you can see in the screenshot. I need to do something extra to be able to call the library? (I am using ubuntu ls 18.04)

Screenshot from 2023-06-21 15-43-52

LiangliangNan commented 1 year ago

I see you did CMake in the directory of one of the exampless. Please use the CMakeLists file from the root directory, e.g.,

    $ cd path-to-root-dir-of-Easy3D
    $ mkdir Release
    $ cd Release
    $ cmake -DCMAKE_BUILD_TYPE=Release ..
    $ make
bgpantojar commented 1 year ago

I actually I did it as you said and building the easy3d is not the problem. I have not figured it out how to run the examples (I supposed was just calling the cmake . inside the example folder as it contains the CMakeList already, and then make

LiangliangNan commented 1 year ago

After you have built the whole project, you can go to the "bin' folder inside the build directory to run the executables. The process is the same as almost all other software.

bgpantojar commented 1 year ago

the build directory is the Release folder right?... inside there is a bin folder, empty though.. I do not see any error when building the library...

Screenshot from 2023-06-21 19-28-16

Screenshot from 2023-06-21 19-28-29

LiangliangNan commented 1 year ago

You haven't built yet (by calling 'make').

bgpantojar commented 1 year ago

Forgot to show that part. Although I found the binary files.

In case I want to do my own program, in the readme it is instructed to do a CMake list with

cmake_minimum_required(VERSION 3.12) project(MyProject) set(CMAKE_CXX_STANDARD 11) # specify C++ standard find_package(Easy3D COMPONENTS viewer REQUIRED) # request Easy3D (recommended to request only needed components) add_executable(Test main.cpp) # create an executable target target_link_libraries(Test easy3d::viewer) # link to necessary Easy3D modules (add more if needed, e.g., algo)

and the main.cpp with

``#include <easy3d/viewer/viewer.h>

include <easy3d/util/initializer.h>

int main(int argc, char** argv) { easy3d::initialize(); easy3d::Viewer viewer("Test"); return viewer.run(); }``

how do I point to the build directory when making the cmake?

LiangliangNan commented 1 year ago

This can be done either through the CMake UI or by directly modifying the value of 'Easy3D_DIR' in the CMake cache file.

I believe this issue can be closed because the questions are not specifically related to Easy3D, but general questions for using cmake.