0

Having an issue with compiling my project, it's a DLL and I'm creating a new thread on DLL_PROCESS_ATTACH doing the following: CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)ChallyThread, hMod, 0, nullptr);

I have my function in a header file as the following: DWORD WINAPI ChallyThread(HMODULE hMod);

& in my Challenges.cpp class I have the function definition.

I'm not entirely sure how to fix this error, from what I've read online it's due to scope resolution however I'm not sure how that would be interpreted into my project as it doesn't seem relevant to my issue?

The error the compiler is giving me is:

Error LNK2019 unresolved external symbol "unsigned long __cdecl ChallyThread(struct HINSTANCE__ *)" (?ChallyThread@@YAKPEAUHINSTANCE__@@@Z) referenced in function DllMain

If anyone could help educate me on the issue that would be greatly appreciated, thanks.

  • My first guess would be your function definition doesn't match the declaration. Second guess would be faulty compiler command. And I suppose you have seen this - https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix?rq=1 – Captain Giraffe May 11 '22 at 11:59
  • it's a linker error, in `DllMain` your are using a defintion of `ChallyThread` which takes a `HINSTANCE *` but it's not impleneted anywhere... Other issue could be that the cpp containing the definition of `ChallyThread` is not inside the compiler chain or compiles with errors – Marco Beninca May 11 '22 at 12:12

0 Answers0