Error without external symbol. c ++

0

The program code:

#include "stdafx.h"
#include "MemLoadLibrary.h"
#include <iostream>
using namespace std;
typedef void(_cdecl* func)();


int main(int argc, _TCHAR* argv[])
{
    CLoad lib;
    HANDLE hLibrary = lib.LoadFromFile("vana.dll");
    func fn = (func)lib.GetProcAddressFromMemory(hLibrary, "TestFunc");
    fn();
    lib.FreeLibraryFromMemory(hLibrary);
    return 0;
}

The error is as follows

  

Severity Code Description Project File Line Suppression State   Error LNK2019 unresolved external symbol "public: void * __thiscall   CLoad :: LoadFromFile (char const *) "(? LoadFromFile @ CLoad @@ QAEPAXPBD @ Z)   referenced in function _main

My question is because of this error or any suggestion to solve it?

    
asked by Perl 13.11.2016 в 14:50
source

1 answer

1

The error tells you that the linker is not able to find the library.

Look at the compilation options since you have to indicate where the precompiled library is located (.dll in the case of dynamic libraries or .a / .lib in the case of static libraries)

In the case of gcc and similar the syntax to be indicated is usually something such that:

gcc -l[libreria_dinamica] fichero.c -l[libreria_estatica]

As for example:

gcc fichero.c -lMemLoadLibrary.a
    
answered by 14.11.2016 / 20:36
source