Is it just me, or does Mt.exe hate absolute paths in the -dll option?
I have a Visual C++ project in Visual Studio 2008 with a reference to an isolated (registration free) COM DLL. I copy the COM DLL into the project's output directory using a Pre-Build Event. In the project's properties, on the Configuration Properties > Manifest Tool > Isolated COM dialog I used the following settings:
Type Library File: $(OutDir)\MyCom.tlb
Registrar Script File:
Component File Name: $(OutDir)\MyCom.dll
Replacements File:
Visual Studio shows me the generated command line command:
mt.exe /nologo
/tlb:"C:\[ ... snip ... ]\OtherProject\Release\MyCom.tlb"
/dll:"C:\[ ... snip ... ]\OtherProject\Release\MyCom.dll"
/outputresource:"..\Release\OtherProject.exe;#1"
It builds fine, but I get a runtime FileNotFound exception. The application can't find MyCom.dll! Changing Component File Name to the following relative path works fine:
Component File Name: ..\$(ConfigurationName)\MyCom.dll
Related
Previously I used File > New > New Module > Import .JAR/.AAR Package
but the option to Import .JAR/.AAR Package from the New Module wizard has been removed on Android Studio 4.2 and following the document which suggests using the Project Structure Dialog reveals no clear answer for importing .AAR module and seems to be outdated
I tried adding the module as a dependency in the project Structure but it did not work
From Android Studio package manager select project:
Then make a new directory in project level named libs
Now right click the libs and select Reveal in finder and then paste here your .aar file.
Now in Build.gradle(Module) add the following implementation.
implementation files('../libs/testaarfile.aar')
and snyc your project.
For Android Studio Bumblebee | 2021.1.1 Patch 3
I have followed steps suggested by the Android developer site:
Copy .aar file into the libs folder of the app
File -> Project Structure... -> Dependencies
Click on "+" icon and select JR/AAR Dependency and select app module
Add .aar file path in step 1.
Check your app’s build.gradle file to confirm a declaration.
If you want to add your .aar file as a different module and not as a dependency to the main 'app' module in Android Studio 4.2, You can try the following:
Create a new folder in the same directory where your 'app' module is located and name it same as your .aar for example 'MyLib' for 'MyLib.aar'
Paste the MyLib.aar file in that directory.
Open notepad and type the following:
configurations.maybeCreate("default")
artifacts.add("default", file('MyLib.aar'))
and save the file as build.gradle in the 'MyLib' folder.
In the project level settings.gradle file, change the line include ':app' to include ':app', ':MyLib'
In the app module build.gradle, add the following line in the depedencies section
implementation project(":MyLib")
Sync the project and do a clean rebuild
I am trying add a .so files to a dlib libary in android studio. I have followed the following steps
Migrate from ndkCompile
If you're using the deprecated ndkCompile, you should migrate to using either CMake or ndk-build. Because ndkCompile generates an intermediate Android.mk file for you, migrating to ndk-build may be a simpler choice.
To migrate from ndkCompile to ndk-build, proceed as follows:
Compile your project with ndkCompile at least once by selecting Build > Make Project. This generates the Android.mk file for you.
Locate the auto-generated Android.mk file by navigating to project-root/module-root/build/intermediates/ndk/debug/Android.mk.
Relocate the Android.mk file to some other directory, such as the same directory as your module-level build.gradle file. This makes sure that Gradle doesn't delete the script file when running the clean task.
Open the Android.mk file and edit any paths in the script such that they are relative to the current location of the script file.
Link Gradle to the Android.mk file .
Disable ndkCompile by opening the build.properties file and removing the following line:
// Remove this line
android.useDeprecatedNdk = true
Apply your changes by clicking Sync Project in the toolbar.
However I am getting this error saying the project cant configure.
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':dlib'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(Li
Caused by: java.lang.NullPointerException
Any help much appreciated.
I am trying to reference a dll project from another project, and am encountering a few difficulties. I have done the following:
Added both projects to a solution
Within my executable project, I add the dll project as a reference.
I add the include directory under Properties --> C/C++ --> Additional Include directories.
I thought this was sufficient - I don't get any errors, my intellisense is detecting the dll project and everything compiles. But when I run, I get the following system error messagebox:
The program can't start because xxx.dll is missing from your computer.
Try reinstalling the program to fix this problem.
So I have tried adding the directory where the dll and lib files are built to to Reference Directories and Library Directories under VC++ Directories in the properties, but still get the same error.
I have downloaded the Dokan Library 0.6.0 (used to write a file system in user mode).
I'm using VS 2013 and have created a project to build the sample called mirror.c. It uses a LIB called dokan.lib. It compiles just fine but the linker gives an error saying
"unresolved external symbol __imp__DokanMain#8". I dumped the lib and __imp__DokanMain#8 does exist within dokan.lib.
Under Properties->Linker->Additional Library Directories, I added "c:\Program Files (x86)\Dokan\DokanLibrary" but that didn't help. Then I changed that to "c:\Program Files (x86)\Dokan\DokanLibrary\dokan.lib" but that also didn't help.
I have read everything at the dokan web site but nothing talks about building with Visual Studio.
Does anyone have any ideas?
Please move "dokan.lib" from Settings -> Linker ->General -> Additional Library Directories. This is meant to include only the paths to the libraries. You can leave the path to the library in tact in there (i.e, C:\Program Files (x86)\Dokan\DokanLibrary).
Place the "dokan.lib" in Settings->Linker->Input->Additional Dependencies.
I want to static link mapi32.lib with my vc++ project in vs.net2005 project. I am using the following import statement inside my testdll.cpp project which is my entry point of the application.
#import "mapi32.lib"
I have put references for C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib path inside c/c++ -> general section and Linker->general section of the project.And also add reference in properties -> debug source files section as well.
But after doing all this I am getting the following error, please help
Error 3 fatal error C1083: Cannot open
type library file: 'c:\program
files\microsoft visual studio
8\vc\platformsdk\lib\mapi32.lib':
Error loading type library/DLL.
c:\TestDll\TestDll\TestDll\TestDll.cpp
14
Regards,
To statically link with mapi.lib, you need to tell the linker about it. The best way to do this is in your project settings. Go to Linker -> Input and add the mapi32.lib to the Additional Dependencies field. You sould do this step for all your project configurations.
To refer to the lib within your code, of course you have to include the appropriate header files.
The #import "mapi32.lib" statement is usually used to import COM object type libraries and has nothing to do with static linking. So you should remove that line.
Good luck.