Click to See Complete Forum and Search --> : JNI-C++ problem


Toots
January 31st, 2000, 07:58 AM
I am using JNI to interface C++ code with Java code. In my C++ code I am using types such as CFile, CStringArray etc. but when I am compiling the code using the command
cl -Ic:\jdk1.2\include -Ic:\jdk1.2\include\win32 filename.c -Fefilename.dll

these types are not being recognized.

I tried adding the path of the include file stdafx.h in the command but then other problems cropped up. What am I doing wrong??

cactus25
February 23rd, 2000, 10:22 AM
This is a tough one. Introducing MFC into your C++ code complicates things.

What is happening is that although you are including afx.h in your C++ code and are providing the path to the includes, you still need to add more.

However, since anytime I have debased my self by using MFC;) I have always done so from within DevStudio. I know that you have to make your project within devstudio aware that you are using MFC by setting it on the Project/Settings/General tab AND include AFX.H.

So, if I was in your shoes, and I didn't get the answer for doing it from the cmd line(sorry), I would :

Purge my code of MFC(what I would do) OR
Bring my C++ code into devstudio and compile your dll through there, setting it like I said before.