I have been trying to use g++ to run the c++ files that came with the mujoco files. I was able to run the model and see it in simulation. Now, I want to program and see the code able to make the simulation do specific tasks. How do I go about it? Simply running c++ file gives following error: /tmp/ccAsFyci.o: In function `profilerinit()': simulate.cpp.text+0xe): undefined reference to `mjv_defaultFigure' simulate.cpp.text+0x18): undefined reference to `mjv_defaultFigure' simulate.cpp.text+0x22): undefined reference to `mjv_defaultFigure' simulate.cpp.text+0x2c): undefined reference to `mjv_defaultFigure' /tmp/ccAsFyci.o: In function `profilerupdate()': simulate.cpp.text+0x8b8): undefined reference to `mju_max' simulate.cpp.text+0x939): undefined reference to `mju_max' simulate.cpp.text+0x9ba): undefined reference to `mju_max' /tmp/ccAsFyci.o: In function `profilershow(_mjrRect)': simulate.cpp.text+0xe6b): undefined reference to `mjr_figure' simulate.cpp.text+0xe9e): undefined reference to `mjr_figure' simulate.cpp.text+0xed1): undefined reference to `mjr_figure' simulate.cpp.text+0xf04): undefined reference to `mjr_figure' /tmp/ccAsFyci.o: In function `sensorinit()': simulate.cpp.text+0xf14): undefined reference to `mjv_defaultFigure' /tmp/ccAsFyci.o: In function `sensorshow(_mjrRect)': simulate.cpp.text+0x12f0): undefined reference to `mjr_figure' /tmp/ccAsFyci.o: In function `loadmodel(GLFWwindow*, char const*)': simulate.cpp.text+0x1459): undefined reference to `mj_loadModel' simulate.cpp.text+0x1482): undefined reference to `mj_loadXML' simulate.cpp.text+0x14b6): undefined reference to `mj_deleteData' simulate.cpp.text+0x14c5): undefined reference to `mj_deleteModel' simulate.cpp.text+0x14e2): undefined reference to `mj_makeData' simulate.cpp.text+0x1502): undefined reference to `mj_forward' simulate.cpp.text+0x1530): undefined reference to `mjr_makeContext' simulate.cpp.text+0x1591): undefined reference to `mjv_updateScene' simulate.cpp.text+0x15ce): undefined reference to `glfwSetWindowTitle' /tmp/ccAsFyci.o: In function `timer()': simulate.cpp.text+0x160d): undefined reference to `glfwGetTime' simulate.cpp.text+0x1622): undefined reference to `glfwGetTime' /tmp/ccAsFyci.o: In function `keyboard(GLFWwindow*, int, int, int, int)': simulate.cpp.text+0x18bb): undefined reference to `glfwMaximizeWindow' simulate.cpp.text+0x18cc): undefined reference to `glfwRestoreWindow' simulate.cpp.text+0x19a4): undefined reference to `mj_resetData' simulate.cpp.text+0x1a44): undefined reference to `mju_copy' simulate.cpp.text+0x1a91): undefined reference to `mju_copy' simulate.cpp.text+0x1ade): undefined reference to `mju_copy' simulate.cpp.text+0x1af7): undefined reference to `mj_forward' simulate.cpp.text+0x1b2a): undefined reference to `mj_step' simulate.cpp.text+0x1b9a): undefined reference to `mj_step' simulate.cpp.text+0x1c0f): undefined reference to `mj_step' simulate.cpp.text+0x1c92): undefined reference to `mj_step' simulate.cpp.text+0x1d1a): undefined reference to `mjr_makeContext' simulate.cpp.text+0x1d53): undefined reference to `mjr_makeContext' simulate.cpp.text+0x1edb): undefined reference to `mjVISSTRING' simulate.cpp.text+0x1f33): undefined reference to `mjRNDSTRING' /tmp/ccAsFyci.o: In function `mouse_button(GLFWwindow*, int, int, int)': simulate.cpp.text+0x1ff7): undefined reference to `glfwGetMouseButton' simulate.cpp.text+0x2014): undefined reference to `glfwGetMouseButton' simulate.cpp.text+0x2031): undefined reference to `glfwGetMouseButton' simulate.cpp.text+0x209a): undefined reference to `glfwGetCursorPos' simulate.cpp.text+0x2122): undefined reference to `mjv_initPerturb' simulate.cpp.text+0x2136): undefined reference to `glfwGetTime' simulate.cpp.text+0x21af): undefined reference to `glfwGetWindowSize' simulate.cpp.text+0x221d): undefined reference to `mjv_select' simulate.cpp.text+0x2270): undefined reference to `mju_copy3' simulate.cpp.text+0x22ec): undefined reference to `mju_sub3' simulate.cpp.text+0x2331): undefined reference to `mju_mulMatTVec' simulate.cpp.text+0x235b): undefined reference to `glfwGetTime' /tmp/ccAsFyci.o: In function `mouse_move(GLFWwindow*, double, double)': simulate.cpp.text+0x241c): undefined reference to `glfwGetWindowSize' simulate.cpp.text+0x242d): undefined reference to `glfwGetKey' simulate.cpp.text+0x2443): undefined reference to `glfwGetKey' simulate.cpp.text+0x24f4): undefined reference to `mjv_movePerturb' simulate.cpp.text+0x2536): undefined reference to `mjv_moveCamera' /tmp/ccAsFyci.o: In function `scroll(GLFWwindow*, double, double)': simulate.cpp.text+0x2593): undefined reference to `mjv_moveCamera' /tmp/ccAsFyci.o: In function `simulation()': simulate.cpp.text+0x2700): undefined reference to `mjv_applyPerturbPose' simulate.cpp.text+0x2719): undefined reference to `mj_forward' simulate.cpp.text+0x2786): undefined reference to `mju_zero' simulate.cpp.text+0x27b0): undefined reference to `mjv_applyPerturbPose' simulate.cpp.text+0x27ce): undefined reference to `mjv_applyPerturbForce' simulate.cpp.text+0x27e7): undefined reference to `mj_step' /tmp/ccAsFyci.o: In function `render(GLFWwindow*)': simulate.cpp.text+0x28c0): undefined reference to `glfwGetFramebufferSize' simulate.cpp.text+0x295a): undefined reference to `mjr_rectangle' simulate.cpp.text+0x2991): undefined reference to `mjr_overlay' simulate.cpp.text+0x29a0): undefined reference to `glfwSwapBuffers' simulate.cpp.text+0x2b16): undefined reference to `mju_min' simulate.cpp.text+0x2bc8): undefined reference to `mju_max' simulate.cpp.text+0x2c12): undefined reference to `mju_max' simulate.cpp.text+0x2c5b): undefined reference to `mjLABELSTRING' simulate.cpp.text+0x2c6b): undefined reference to `mjFRAMESTRING' simulate.cpp.text+0x2ca6): undefined reference to `mju_max' simulate.cpp.text+0x2d13): undefined reference to `mju_max' simulate.cpp.text+0x2d82): undefined reference to `glfwGetTime' simulate.cpp.text+0x2e7e): undefined reference to `glfwGetTime' simulate.cpp.text+0x2ec8): undefined reference to `mjv_updateScene' simulate.cpp.text+0x2eeb): undefined reference to `mjr_render' simulate.cpp.text+0x2f23): undefined reference to `mjr_readPixels' simulate.cpp.text+0x3102): undefined reference to `mjr_drawPixels' simulate.cpp.text+0x3144): undefined reference to `mjr_overlay' simulate.cpp.text+0x3188): undefined reference to `mjr_overlay' simulate.cpp.text+0x31d5): undefined reference to `mjr_overlay' simulate.cpp.text+0x320e): undefined reference to `mjr_overlay' simulate.cpp.text+0x3257): undefined reference to `mjRNDSTRING' simulate.cpp.text+0x327c): undefined reference to `mjRNDSTRING' simulate.cpp.text+0x3311): undefined reference to `mjVISSTRING' simulate.cpp.text+0x3336): undefined reference to `mjVISSTRING' simulate.cpp.text+0x352c): undefined reference to `mjr_overlay' simulate.cpp.text+0x35a9): undefined reference to `glfwSwapBuffers' /tmp/ccAsFyci.o: In function `main': simulate.cpp.text+0x35e3): undefined reference to `mj_version' simulate.cpp.text+0x3607): undefined reference to `mj_version' simulate.cpp.text+0x361d): undefined reference to `mju_error' simulate.cpp.text+0x3627): undefined reference to `mj_activate' simulate.cpp.text+0x362c): undefined reference to `glfwInit' simulate.cpp.text+0x3644): undefined reference to `glfwGetPrimaryMonitor' simulate.cpp.text+0x364c): undefined reference to `glfwGetVideoMode' simulate.cpp.text+0x3664): undefined reference to `glfwWindowHint' simulate.cpp.text+0x3683): undefined reference to `glfwCreateWindow' simulate.cpp.text+0x3693): undefined reference to `glfwTerminate' simulate.cpp.text+0x36a9): undefined reference to `glfwMakeContextCurrent' simulate.cpp.text+0x36b3): undefined reference to `glfwSwapInterval' simulate.cpp.text+0x36ca): undefined reference to `glfwGetWindowSize' simulate.cpp.text+0x36e1): undefined reference to `glfwGetFramebufferSize' simulate.cpp.text+0x370a): undefined reference to `mjv_makeScene' simulate.cpp.text+0x3714): undefined reference to `mjv_defaultCamera' simulate.cpp.text+0x371e): undefined reference to `mjv_defaultOption' simulate.cpp.text+0x3728): undefined reference to `mjr_defaultContext' simulate.cpp.text+0x3742): undefined reference to `mjr_makeContext' simulate.cpp.text+0x375d): undefined reference to `glfwSetKeyCallback' simulate.cpp.text+0x376e): undefined reference to `glfwSetCursorPosCallback' simulate.cpp.text+0x377f): undefined reference to `glfwSetMouseButtonCallback' simulate.cpp.text+0x3790): undefined reference to `glfwSetScrollCallback' simulate.cpp.text+0x37a1): undefined reference to `glfwSetDropCallback' simulate.cpp.text+0x37b2): undefined reference to `glfwSetWindowRefreshCallback' simulate.cpp.text+0x37b9): undefined reference to `mjcb_time' simulate.cpp.text+0x37f0): undefined reference to `glfwPollEvents' simulate.cpp.text+0x37fc): undefined reference to `glfwWindowShouldClose' simulate.cpp.text+0x3814): undefined reference to `mj_deleteData' simulate.cpp.text+0x3823): undefined reference to `mj_deleteModel' simulate.cpp.text+0x382d): undefined reference to `mjr_freeContext' simulate.cpp.text+0x3837): undefined reference to `mjv_freeScene' simulate.cpp.text+0x383c): undefined reference to `glfwTerminate' simulate.cpp.text+0x3841): undefined reference to `mj_deactivate' collect2: error: ld returned 1 exit status
My guess is that you are not linking the library... Look at the makefile in the sample directory, it shows you how to compile and link.