Please help, I have spent all day trying to make my c++ app compile.
My project contains one source file: Foo.cpp. Here is its code:
#include <jni.h>
#include <com_Foo.h>
JNIEXPORT jint JNICALL Java_com_Foo_add
(JNIEnv * env, jobject obj, jint x, jint y)
{
return x+y;
}
as you can see I was trying to use JNI, but I don't think that has anything to do with the problem. Here is what I tried on the command line:
C:\Users\michael\cworkspace\foo>cl -LD Foo.cpp -FeFoo.dll
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
Foo.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/dll
/implib:Foo.lib
/out:Foo.dll
Foo.obj
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
In my environment I have set:
INCLUDE: C:_\include;C:\frankenstein\includes;C:\Program Files\Java\jdk1.6.0_24\include;C:\Program Files\Java\jdk1.6.0_24\include\win32;C:_\include\win32;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include
LIBPATH: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
I checked in the lib directory, it contains a "libcmt.lib" file. Don't know if it is case sensitive, but I know that I never changed anything in the visual studio files or directories.
Would somebody please tell me how I can make this work?