So I am following the mapping recipes guide to try and understand how to use javacpp. I have a header file and a dll file created from a .cpp file that implements the header file. When I try to link this dll file though it gives me this:
LINK : fatal error LNK1181: cannot open input file 'MyFunc.lib'
Exception in thread "main" java.lang.RuntimeException: Process exited with an error: 2
at org.bytedeco.javacpp.tools.Builder.generateAndCompile(Builder.java:620)
at org.bytedeco.javacpp.tools.Builder.build(Builder.java:1167)
at org.bytedeco.javacpp.tools.Builder.main(Builder.java:1450)
The cl compiler seems to be complaining that it can't open the lib input file. First of all as I said the file I use is a dll, not a lib. Why is it even trying to link a lib file? I tried using preload instead of link as well but than I just get this:
jniSample.obj : error LNK2001: unresolved external symbol "public: int __thiscall test::MyFunc::add(int,int)" (?add@MyFunc@test@@QAEHHH@Z)
jniSample.dll : fatal error LNK1120: 1 unresolved externals
Exception in thread "main" java.lang.RuntimeException: Process exited with an error: 2
at org.bytedeco.javacpp.tools.Builder.generateAndCompile(Builder.java:620)
at org.bytedeco.javacpp.tools.Builder.build(Builder.java:1167)
at org.bytedeco.javacpp.tools.Builder.main(Builder.java:1450)
(the add function is declared in the header file and its implementation is in the aforementioned dll file which seems to not be able to link). Am I doing wrong? I have put the correct file path under linkpath and preloadpath respectively and have used the exact name of the dll file (it being MyFunc)
Update: I read up a little bit and I actually do need the lib file. I recompiled my dll with cl.exe and got the lib file. Now I am encountering another issue though. It finds the lib file just fine but even though the lib and dll files are in the exact same directory I specified under the linkpath in the @Platform annotation it doesn't seem to be able to find the dll or maybe it just doesn't even try to?
So I am following the mapping recipes guide to try and understand how to use javacpp. I have a header file and a dll file created from a .cpp file that implements the header file. When I try to link this dll file though it gives me this: LINK : fatal error LNK1181: cannot open input file 'MyFunc.lib' Exception in thread "main" java.lang.RuntimeException: Process exited with an error: 2 at org.bytedeco.javacpp.tools.Builder.generateAndCompile(Builder.java:620) at org.bytedeco.javacpp.tools.Builder.build(Builder.java:1167) at org.bytedeco.javacpp.tools.Builder.main(Builder.java:1450)
The cl compiler seems to be complaining that it can't open the lib input file. First of all as I said the file I use is a dll, not a lib. Why is it even trying to link a lib file? I tried using preload instead of link as well but than I just get this:
jniSample.dll : fatal error LNK1120: 1 unresolved externals Exception in thread "main" java.lang.RuntimeException: Process exited with an error: 2 at org.bytedeco.javacpp.tools.Builder.generateAndCompile(Builder.java:620) at org.bytedeco.javacpp.tools.Builder.build(Builder.java:1167) at org.bytedeco.javacpp.tools.Builder.main(Builder.java:1450)
(the add function is declared in the header file and its implementation is in the aforementioned dll file which seems to not be able to link). Am I doing wrong? I have put the correct file path under linkpath and preloadpath respectively and have used the exact name of the dll file (it being MyFunc)
Update: I read up a little bit and I actually do need the lib file. I recompiled my dll with cl.exe and got the lib file. Now I am encountering another issue though. It finds the lib file just fine but even though the lib and dll files are in the exact same directory I specified under the linkpath in the @Platform annotation it doesn't seem to be able to find the dll or maybe it just doesn't even try to?