I have attempted to modify the basic tutorial program to include an AssimpLoader. I can compile the program just fine, but when I attempt to link it (using the basic compiling and linking lines designated in the C++ tutorial, I get the following output:
main.o: In function `main':
main.cpp:(.text.startup+0x177): undefined reference to `AssimpLoader::AssimpLoader()'
main.cpp:(.text.startup+0x19b): undefined reference to `AssimpLoader::~AssimpLoader()'
main.cpp:(.text.startup+0x1d8): undefined reference to `AssimpLoader::~AssimpLoader()'
collect2: error: ld returned 1 exit status
My program looks as follows:
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "assimpLoader.h"
int main(int argc, char *argv[]) {
//open a new window framework
PandaFramework framework;
framework.open_framework(argc, argv);
//set the window title to My Panda3D Window
framework.set_window_title("My Panda3D Window");
//open the window
WindowFramework *window = framework.open_window();
AssimpLoader modelLoader;
//do the main loop, equal to run() in python
framework.main_loop();
//close the window framework
framework.close_framework();
return (0);
}
and my build shell script looks like:
#!/bin/bash
PYTHON_INCLUDE_DIR="/usr/include/python3.5"
PANDA3D_INCLUDE_DIR="${HOME}/Documents/panda3d/built/include"
PANDA3D_ASSIMP_INCLUDE_DIR="${HOME}/Documents/panda3d/pandatool/src/assimp"
ASSIMP_INCLUDE_DIR="${HOME}/Documents/assimp/include/assimp"
ASSIMP_INCLUDE_DIR2="${HOME}/Documents/assimp/include"
ASSIMP_LIB_DIR="${HOME}/Documents/assimp/lib"
PANDA3D_LIB_DIR="${HOME}/Documents/panda3d/built/lib"
EIGEN_INC_DIR="/usr/include/eigen3"
function compile_link {
rm -rf main.o
g++ -c main.cpp -o main.o -std=gnu++11 -O2 -I${PYTHON_INCLUDE_DIR} -I${EIGEN_INC_DIR} -I${PANDA3D_INCLUDE_DIR} -I${PANDA3D_ASSIMP_INCLUDE_DIR} -I${ASSIMP_INCLUDE_DIR} -I${ASSIMP_INCLUDE_DIR2}
g++ main.o -o PandaTutorial -L${PANDA3D_LIB_DIR} -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct -lp3assimp
}
compile_link
I’ve verified that if I comment out the line “AssimpLoader modelLoader;” the linker problgm goes away, and I am able to run the sample and get the expected window.
I know this sort of thing is a noobish question, but I’d be super-grateful for any help (and education!).
Thanks,
jonbitzen