Beginner: building sample code with Windows VS got LNK2019 error

Discussion in 'Simulation' started by yongxf, Jun 26, 2016.

  1. Hi all,
    I am a beginner to Mujoco Pro, I can run the
    simulate ../model/humanoid.xml
    from the bin folder using command prompt in windows and everything works fine.

    For current stage, My goal is: compile the sample code by VS2013 in Windows. But I got the 8 LNK2019 errors like the following:
    test_0623.obj : error LNK2019: unresolved external symbol __imp__mj_activate referenced in function _main

    My procedure to build a project is:
    1. Build a new win32 console application project called My_Project in VS2013
    2. move all the header files, mjkey.txt, and one of the source files to My_Project\My_Project folder
    3. build a lib folder under My_Project folder, and copy the mujoco131.lib and glfw3.lib and corresponding .dll files to it.
    4. link the .lib files by modifying: Configuration Properties => Linker => Input => Additional dependencies (and Configuration Properties => Linker => General => Additional Library directories)
    5. Force the DLLs to get copied to the output directory by: input XCOPY "$(SolutionDir)lib\*.DLL" "$(TargetDir)" /D /K /Y into Configuration Properties -> Build Events -> Post-Build Event -> Command Line
    6. add the header files and source files to the solution.
    7. Build solution.
    Did I miss something? Is this the right way to use the package in Windows? I think compiling stuff from command line is similar with working from Visual Studio IDE.

    I have been stuck in this step for several days. I appreciate if someone can help me with this.

    Thanks alot!
    Best regards,
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member