$ cat opencv_world420d.cpp
#include <iostream>
using namespace std;
void ExternalFunFromLib()
{
cout << "fun from opencv_world420d.dll\n";
}
$ /usr/bin/g++ -c -shared -Wall ./opencv_world420d.cpp -o ./opencv_world420d.o -std=c++11
$ /usr/bin/g++ -shared -o opencv_world420d.dll opencv_world420d.o
$ ldd "C:\\PROGRA~2\INTERN~1\IEXPLORE.EXE" | head -1 | awk '{ print $3}' | sed "s/\/cygdrive\/c/C:/;s/\//\\\\/g;"
C:\Windows\SYSTEM32\ntdll.dll
$ file $(ldd "C:\\PROGRA~2\INTERN~1\IEXPLORE.EXE" | head -1 | awk '{ print $3}' | sed "s/\/cygdrive\/c/C:/;s/\//\\\\/g;")
C:\Windows\SYSTEM32\ntdll.dll: PE32+ executable (DLL) (console) x86-64, for MS Windows
$ file ./opencv_world420d.dll
./opencv_world420d.dll: PE32+ executable (DLL) (console) x86-64, for MS Windows
Created the object file opencv_world420d.o$ cat ProjOpenCM.cpp
#include <iostream>
using namespace std;
extern void ExternalFunFromLib();
int main()
{
cout << "hai\n";
ExternalFunFromLib();
return 0;
}
$ /usr/bin/g++ -Wall ./ProjOpenCM.cpp -o ./ProjOpenCM.exe -std=c++11 -L. -lopencv_world420d
$ file "C:\\PROGRA~2\INTERN~1\IEXPLORE.EXE"
C:\PROGRA~2\INTERN~1\IEXPLORE.EXE: PE32 executable (GUI) Intel 80386, for MS Windows
$ file ./ProjOpenCM.exe
./ProjOpenCM.exe: PE32+ executable (console) x86-64, for MS Windows
Compiled ProjOpenCM.cpp using the option -L. => take the library .dll from current directory .C:\Users\murugesandins\experts_exchange> DIR
Volume in drive C is MURUGAN
Volume Serial Number is 1603-C636
Directory of C:\Users\murugesandins\experts_exchange
Sun 29-Mar-2020 12:41 PM <DIR> .
Sun 29-Mar-2020 12:41 PM <DIR> ..
Sun 29-Mar-2020 12:29 PM 119 opencv_world420d.cpp
Sun 29-Mar-2020 12:29 PM 141 ProjOpenCM.cpp
2 File(s) 260 bytes
2 Dir(s) 411,769,749,504 bytes free
C:\Users\murugesandins\experts_exchange> g++ -c -shared -Wall ./opencv_world420d
.cpp -o ./opencv_world420d.o -std=c++11
C:\Users\murugesandins\experts_exchange> g++ -shared -o opencv_world420d.dll ope
ncv_world420d.o
C:\Users\murugesandins\experts_exchange> g++ -Wall ./ProjOpenCM.cpp -o ./ProjOpe
nCM.exe -std=c++11 -L. -lopencv_world420d
C:\Users\murugesandins\experts_exchange> DIR
Volume in drive C is MURUGAN
Volume Serial Number is 1603-C636
Directory of C:\Users\murugesandins\experts_exchange
Sun 29-Mar-2020 12:42 PM <DIR> .
Sun 29-Mar-2020 12:42 PM <DIR> ..
Sun 29-Mar-2020 12:29 PM 119 opencv_world420d.cpp
Sun 29-Mar-2020 12:42 PM 137,330 opencv_world420d.dll
Sun 29-Mar-2020 12:42 PM 2,329 opencv_world420d.o
Sun 29-Mar-2020 12:29 PM 141 ProjOpenCM.cpp
Sun 29-Mar-2020 12:42 PM 161,596 ProjOpenCM.exe
5 File(s) 301,515 bytes
2 Dir(s) 411,767,050,240 bytes free
C:\Users\murugesandins\experts_exchange>ProjOpenCM.exe
hai
fun from opencv_world420d.dll
C:\Users\murugesandins\experts_exchange>MOVE
C:\Users\murugesandins\experts_exchange> MOVE opencv_world420d.dll ..
1 file(s) moved.
C:\Users\murugesandins\experts_exchange> ProjOpenCM.exe
C:\Users\murugesandins\experts_exchange>
Since I have moved opencv_world420d.dll and started executing ProjOpenCM.exe.For Visual Studio you'll want to right click on your project in the solution explorer and then click on Properties.
Next open Configuration Properties and then Linker.
Now you want to add the folder you have the Allegro libraries in to Additional Library Directories,
Linker -> Input you'll add the actual library files under Additional Dependencies.
For the Header Files you'll also want to include their directories under C/C++ -> Additional Include Directories.
If there is a dll have a copy of it in your main project folder, and done.
I would recommend putting the Allegro files in the your project folder and then using local references in for the library and header directories.
Doing this will allow you to run the application on other computers without having to install Allergo on the other computer.
This was written for Visual Studio 2008. For 2010 it should be roughly the same.
I am not having Windows visual studio.
Your project is missing the library opencv_world420d.dll
Example of using cygwin error:
Open in new window
cyggmp-10.dll installation has been missed here.Hence After installing libgmp10 will resolve that issue.
Reason:
gawk.exe has been compiled using many *.dll files including cyggmp-10.dll
Sample dependencies for iexplore.exe
Open in new window
Like the same:1. search where you are having the file opencv_world420d.dll in your system
Initially search that file using WinKeyF (windows find) or
we can search the same after opening
C:\Windows\System32\cmd.ex
Open in new window
2. If not found you have to download the source having opencv_world420d.dllsince the functions you are invoking are present at external dynamic link library (.dll) => (.dll being .so or .sl at other OS)
Once found or downloaded, add that dll file at project source libraries.
Since I do not have visual studio I cannot inform the way to add .dll at visual studio.
We used to make changes at Makefile at all OS (excluding visual studio including cygwin at windows)