c++ - Undefined reference ... But all is linked -


i have link problem codeblocks ide. think should fine.

i want work laslib library. provide .lib file i've linked in codeblocks ide (such did ...). i've included "inc" folder containing .hpp includes.

atm, did minimal requirement include external library.

then, in "main" function, i've included necessary files, codeblocks intellisense provide me prototypes of functions (so links guess).

here code :

#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 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 file lasreader = lasreadopener.open();  //  create , open writer laswriter* laswriter = laswriteopener.open(&lasreader->header);  // loop through points (note 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 inventory (keeps track of min/max values header)     laswriter->update_inventory(&lasreader->point); }  laswriter->update_header(&lasreader->header, true);  laswriter->close(); lasreader->close();  delete laswriter; delete lasreader; } 

and errors :

main.cpp|17|undefined reference `lasreadopener::lasreadopener()'| main.cpp|18|undefined reference `laswriteopener::laswriteopener()'| 

etc ...

i didnt see i've did wrong ... i've tried "hard" method copying .hpp , .lib in mingw corresponding folders ...

any ideas?

with file structure follows:

./lastools ./myproject 

from within ./myproject compiled so:

g++ main.cpp -i../lastools/laslib/inc/ -i../lastools/laszip/src -llas -l. 

this resulted in error free compilation of code:

#include "lasreader.hpp" #include "laswriter.hpp"  int main(int argc, char *argv[]){   lasreadopener lasreadopener;   lasreadopener.set_file_name("original.las");   lasreader* lasreader = lasreadopener.open();    while (lasreader->read_point()) {}    lasreader->close();   delete lasreader;    return 0; } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -