我有 CodeBlocks IDE 的链接问题。但我认为一切都应该没问题。
我想使用 laslib 库。他们提供了一个我在 CodeBlocks IDE 中链接的 .lib 文件(我通常这样做......)。然后我包含了包含 .hpp 的“inc”文件夹。
Atm,我做了包含外部库的最低要求。
然后,在我的“主”函数中,我包含了必要的文件,CodeBlocks 智能感知为我提供了函数的原型(所以我猜链接很好)。
这是我的代码:
#include <iostream>
#include <vector>
#include "lasreader.hpp"
#include "laswriter.hpp"
#include "lasdefinitions.hpp"
#define FILENAME "D:\\las.las"
#define FILEOUT "D:\\out"
int main(int argc, char** argv)
{
// Assume that's correct for simplicity @TODO : check argv
std::string filename = FILENAME;//argv[1];
std::string file_out = FILEOUT; //argv[2];
LASreadOpener lasreadopener;
LASwriteOpener laswriteopener;
lasreadopener.set_file_name(filename.c_str());
laswriteopener.set_file_name(file_out.c_str());
lasreadopener.parse(0, NULL); // parse without args
// Declare lasreader
LASreader* lasreader;
// Open the file
lasreader = lasreadopener.open();
// Create and open the writer
LASwriter* laswriter = laswriteopener.open(&lasreader->header);
// Loop through the points (note they will already be filtered)
while (lasreader->read_point())
{
// Show coordinates
std::cout << lasreader->point.get_x() << ", " << lasreader->point.get_y() << ", " << lasreader->point.get_z() << std::endl;
// Write point
laswriter->write_point(&lasreader->point);
// Add it to the inventory (keeps track of min/max values for the header)
laswriter->update_inventory(&lasreader->point);
}
laswriter->update_header(&lasreader->header, TRUE);
laswriter->close();
lasreader->close();
delete laswriter;
delete lasreader;
}
错误是:
main.cpp|17|undefined reference to `LASreadOpener::LASreadOpener()'|
main.cpp|18|undefined reference to `LASwriteOpener::LASwriteOpener()'|
ETC ...
我没有看到我做错了什么......我已经尝试过在mingw相应文件夹中复制.hpp和.lib的“硬”方法......
有任何想法吗?