0

I am trying to make a dll file using code blocks

My cpp file contains ONLY this line of code :

#include <jni.h>

and it's giving me this bunch of errors:

||=== Build: Debug in transparency (compiler: GNU GCC Compiler) ===|
||Warning: resolving _GetModuleHandleA@4 by linking to _GetModuleHandleA|
||Warning: resolving _GetProcAddress@8 by linking to _GetProcAddress|
||Warning: resolving _VirtualQuery@12 by linking to _VirtualQuery|
||Warning: resolving _VirtualProtect@16 by linking to _VirtualProtect|
||Warning: resolving _EnterCriticalSection@4 by linking to _EnterCriticalSection|
||Warning: resolving _TlsGetValue@4 by linking to _TlsGetValue|
||Warning: resolving _GetLastError@0 by linking to _GetLastError|
||Warning: resolving _DeleteCriticalSection@4 by linking to _DeleteCriticalSection|
||Warning: resolving _InitializeCriticalSection@4 by linking to _InitializeCriticalSection|
C:\Program Files (x86)\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\4.9.2\..\..\..\libmingw32.a(tlsthrd.o):tlsthrd.c|| undefined reference to `LeaveCriticalSection@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\4.9.2\..\..\..\libmingw32.a(tlsthrd.o):tlsthrd.c|| undefined reference to `LeaveCriticalSection@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\4.9.2\..\..\..\libmingw32.a(tlsthrd.o):tlsthrd.c|| undefined reference to `LeaveCriticalSection@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\bin\..\lib\gcc\mingw32\4.9.2\..\..\..\libmingw32.a(tlsthrd.o):tlsthrd.c|| undefined reference to `LeaveCriticalSection@4'|
||error: ld returned 1 exit status|
||=== Build failed: 5 error(s), 9 warning(s) (0 minute(s), 0 second(s)) ===|

I need that jni.h because I'm creating this dll to use it in a java program

EDIT : I'm running windows 10 64 bit

mdnfiras
  • 882
  • 1
  • 15
  • 28
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Richard Critten Jul 06 '17 at 09:14
  • @RichardCritten i am a beginner and the only line of code in program is #include , I haven't done nothing yet – mdnfiras Jul 06 '17 at 09:19
  • @RichardCritten Yes, while this is technically a dupe of the linked question, a full answer to this question would include which library is missing from the link command line, so not a duplicate in spirit as far as I am concerned. – JeremyP Jul 06 '17 at 09:21
  • @FiRas can you put the linker command line in the question. Also, what operating system are you compiling on and for. `LeaveCriticalSection` is a Windows system call, so it looks like your linker command line is wrong. – JeremyP Jul 06 '17 at 09:25
  • 2
    FYI, do not tag a question with both C *and* C++ tags. They are differenat languages. If your question is only about one of them then only tag one of them. – Toby Jul 06 '17 at 09:25
  • @JeremyP what is a linker command line? where do i find it? i'm compiling on windows 10 64bit – mdnfiras Jul 06 '17 at 09:33
  • Apart from a `.h`file, your `.dll` needs other libs to be added to the final file. These libs are told in the command used to build the `.dll`. Look down in the "Buid log" tab to see the command C::B uses. Typical needed libs are kernel32, user32, etc. But you must find the required ones for your .dll – Ripi2 Jul 06 '17 at 12:40

0 Answers0