Link Error during using nglib

Kaka Li
  • Kaka Li

    Kaka Li - 2010-03-18

    I have compiled the nglib.lib and nglib.dll of 4.9.12 with VS2008. I want to develop some meshing application with nglib. I include the nglib.h and set nglib.lib location (..\nglib-inst_Win32\lib). But every function i use in nglib.h cannot link successful. ex. error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl Ng_Init(void)" (__imp_?Ng_Init@@YAXXZ),referenced in  function _main

  • Philippose Rajan

    Hello there,

    A Good Evening to you!

    You have mentioned that you have included "nglib.h" in your application, and set the location of the "nglib.lib" file…. but have you told the compiler, that the library you want to link to is the "nglib.lib" file? Only specifying the location where the lib file exists is not enough… you also need to specify the lib file itself in the linker command line.

    Let me know if you are still having problems….

    Have a nice day!


  • Kaka Li

    Kaka Li - 2010-03-19

    Very glad to receive your answer.
    Of coz i have pointed the "nglib.lib", the linker command line if below:

    /OUT:"D:\Workspace\NgTest\Debug\NgTest.exe" /INCREMENTAL /NOLOGO /LIBPATH:"D:\Workspace\NetGen-Bak\nglib-inst_Win32\bin" /LIBPATH:"D:\OpenCASCADE6.3.0\ros\win32\lib" /MANIFEST /MANIFESTFILE:"Debug\NgTest.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\Workspace\NgTest\Debug\NgTest.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT nglib.lib  kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

    I usually use .h .lib and .dll to import some API, but I dont know what's the matter with nglib. Thank you very much for your quick response.

    Have a nice day too!

  • Joachim Schoeberl

    be sure to use the same platform setting, 32 or 64 bit Release,
    Debug libs are not provided

  • Thomas Kleylein

    Thomas Kleylein - 2011-07-13

    Hi qdkaka!

    I have exactly the same problem. i also build nglib successfull with x64. but when i try to link it to my project i get linker errors for every function i try to use:

    pintNetgen.obj : error LNK2019: unresolved external symbol "public: void __cdecl pintNetgen::Ng_Init(void)" (?Ng_Init@pintNetgen@@QEAAXXZ) referenced in function "public: class pintNetgen * __cdecl pintNetgen::createNetgen(class MObject)" (?createNetgen@pintNetgen@@QEAAPEAV1@VMObject@@@Z)

    i try to use nglib inside my class. i included the header and the lib. i build the lib as release and x64. are there any preprocessor flags i have to define?

    i use visual studio 2010. could there be the problem? the lib does compile without any errors.

    Thank you in advance.

  • Marco Nanni

    Marco Nanni - 2012-02-16

    Hello All,

    Try to put on the right place in front of your file:

    namespace nglib {

    #include "nglib.h"


    using namespace nglib;

    It should help.


  • Anonymous - 2012-12-24

    Hello qdkaka,my program have the same problem when i use nglib.lib. Have you solved it ?


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks