How to link open3d in g++
- Dominant language
- C++
- Stars
- 14k
- Forks
- 2.6k
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 6
Description
### Checklist
- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).
### My Question
I built open3d from source successfully, now I wanna test a simple example as follow:
```
#include
#include
#include
#include
int main(int argc, char* argv[]){
open3d::io::ReadPointCloudOption readOption;
readOption.remove_infinite_points = true;
readOption.remove_nan_points = true;
open3d::geometry::PointCloud pcl_o3d;
std::string path = std::string(argv[1]);
bool is_readOK = open3d::io::ReadPointCloud(path, pcl_o3d, readOption);
if (is_readOK == false){
std::cout << "xxxxxxxxx failed to read " << argv[1] << " xxxxxxxxx" << std::endl;
return -1;
}
std::cout << "Open point cloud successfully" << std::endl;
return 0;
}
```
Then I built the program with g++
`g++ example.cpp -o example.o -I/usr/local/include/ -I/usr/include/eigen3/ -lstdc++ -fopenmp -L/usr/local/lib -l:libOpen3D.a -l:libOpen3D_3rdparty_qhullcpp.a -l:libOpen3D_3rdparty_qhull_r.a`
The error of the linking process as follow:
```
/usr/bin/ld: /tmp/ccFB4BCs.o: in function `main':
example.cpp:(.text+0xe0): undefined reference to `open3d::io::ReadPointCloud(std::__cxx11::basic_string, std::allocator > const&, open3d::geometry::PointCloud&, open3d::io::ReadPointCloudOption const&)'
collect2: error: ld returned 1 exit status
```
please correct me how to link open3d correctly with g++
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.