LoadLibrary function - compile error

Hello,
I'm trying to build small program which uses a dll file using VC++.
I get compile error saying that:

error C2039: 'LoadLibrary' : is not a member of '`global namespace''
error C3861: 'LoadLibrary': identifier not found

LoadLibrary is included in winbase.h file and my all files include stdafx.h so, winbase is included already. I could not figure out why it fails to compile.
Here is the code:

1
2
3
4
5
6
7
      if(m_lib) 
         ::FreeLibrary(m_lib);
      if((m_lib=::LoadLibrary(path))!=NULL)
        {
         m_pfnManVersion=reinterpret_cast<ManVersion_t>(::GetProcAddress(m_lib,"ManVersion"));
         m_pfnManCreate =reinterpret_cast<ManCreate_t>(::GetProcAddress(m_lib,"ManCreate"));
        }


Thanks in advence.
What type of project have you defined?
You're clearly not including the correct header file. If you're not using MFC, you ought to just include Windows.h.

There's something uncomfortable about that use of m_lib. You should know when it's valid, you should need to check like that. It indicates a structural problem with your program.
Topic archived. No new replies allowed.