0

I am trying to work with QT to display models in 3D. To load the models I want to use assimp. But I get this error when using the Importer class. My code can be as simple as the following:

#include <assimp/Importer.hpp> 

void foo() {
  Assimp::Importer importer;
  const aiScene* scene = importer.ReadFile( fileName, aiProcess_Triangulate);
}

In QT creator I used the feature to include an external library, so my in my .pro file, the following added.

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/libs/ -lassimp-vc142-mt
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/libs/ -lassimp-vc142-mtd
else:unix: LIBS += -L$$PWD/libs/ -lassimp-vc142-mt

INCLUDEPATH += $$PWD/libs/include
DEPENDPATH += $$PWD/libs/include

That is the location of my .lib .dll and the include folder of assimp. I downloaded assimp 5.0.1 to create the .lib, but I also tried 3.3.1. I have the same problem when trying to add assimp to a visual studio project.

It could be that I'm forgetting a step in the process of adding a library. But I did not find any solution that worked in my searching of the web.

The exact errors are:

error: undefined reference to Assimp::Importer::Importer()'
debug/main.o: In function foo()

and

libs\include\assimp\Importer.hpp:655: error: undefined reference to Assimp::Importer::ReadFile(char const*, unsigned int)
debug/main.o: In function Assimp::Importer::ReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)
eyllanesc
  • 221,139
  • 17
  • 121
  • 189
Villager
  • 11
  • 2

0 Answers0