How to build 102 example of libigl tutorial in Visual C++? -
i using visual c++ 10.0(2010) on win7 32bit os.
when tried build basic examples of libigl github tutorials: libigl tutorials
the following installation code works fine:
#include <igl/cotmatrix.h> #include <eigen/dense> #include <eigen/sparse> #include <iostream> int main() { eigen::matrixxd v(4,2); v<<0,0, 1,0, 1,1, 0,1; eigen::matrixxi f(2,3); f<<0,1,2, 0,2,3; eigen::sparsematrix<double> l; igl::cotmatrix(v,f,l); std::cout<<"hello, mesh: "<<std::endl<<l*v<<std::endl; return 0; }
which indicates there no problem per tutorials.
however, cannot tutorial 102 through:
#include <igl/readoff.h> #include <igl/viewer/viewer.h> eigen::matrixxd v; eigen::matrixxi f; int main(int argc, char *argv[]) { // load mesh in off format igl::readoff("../shared/bunny.off", v, f); // plot mesh igl::viewer::viewer viewer; viewer.data.set_mesh(v, f); viewer.launch(); }
after getting series of building error message of missing special headers, , adding corresponding directory containing header including directory of vs, there still header missing cannot found in computer.
except include directory required per tutorial:
x:\program\libigl-master\include; $(includepath);
i added others follows:
x:\program\libigl-master\external\glfw\include; x:\program\libigl-master\external\anttweakbar\src; x:\program\libigl-master\external\anttweakbar\include; x:\program\libigl-master\external\glew\include;
error message still there:
x:\program\libigl-master\external\glfw\include\glfw\glfw3.h(163): fatal error c1083: cannot open include file: 'gl/glcorearb.h': no such file or directory 1>
so added:
x:\program\libigl-master\external\glfw\include\glfw d:\program\libigl-master\external\glfw\include\
and got:
x:\program\libigl-master\external\glfw\include\glfw\glfw3.h(163): fatal error c1083: cannot open include file: 'gl/glcorearb.h': no such file or directo
which not exist in computer.
what should do?
i had exact same issue, , thing adding include paths won't make work - said would. because libigl auxiliary library manipulate 3d shapes, examples use more (their matrix system comes eigen, graphical system uses glfw+glew, among many others).
but can of examples working on msvs setting essential libraries. download following:
- eigen: basic matrix/vector arithmetics etc.
- glfw: used create , handle windows opengl.
- glew: library has actual opengl function bindings use opengl functions.
note these libraries essential compile examples jut because when examples made, creators had enviroment set them (otherwise have code hand opengl , windows/linux windows handling etc. in case you're interested, this "pure opengl" code looks like). have is: set enviroment these libraries. how it:
after creating empty project in msvs, go solution explorer > right click project > properties. you've opened property pages, project configurations done. need specify 3 things: compiler can find headers, libraries we're using , can find these libraries.
first set headers: on left menu expand c/c++ > general, , on right, select aditional include directories, click on down arrow , click edit. window open blank fields, click them twice add items. add eigen header path, libigl folder path, glew folder path , glfw folder path in each line (this confusing interface).
ok, need specify libraries we're going use. again, in left menu, go linker > input > aditional dependencies (almost same kind of interface). add glew32s.lib, glfw3.lib , opengl32.lib (one each line). finally, specify where libraries are. go linker > general > aditional library directories, , specify path downloaded glew32s.lib , glfw3.lib are. (something "c:\users...\glfw-3.2.1.bin.win32\lib-vc2010") - make sure you're specifying path right compiler - instance, if you're using msvs 32 bits 2010 should select vc2010 , not mingw-64.
if create source file in project using tutorial 2012 source code should compile, might have specify paths dll's such opengl32.dll if it's not in system path.
finally, 1 last thing might go wrong has called runtime library - it's in c/c++ > code generation > runtime library. describes method compile code, , each library we're using compiled using different one, might errors... don't know lot that, know mine wasn't working default one, changed /md , worked. go figure.
ps: might need update graphics card opengl work.
Comments
Post a Comment