This is driving me crazy, I'm trying to building the log4cxx library in order to use in a c++ project I've been using. I'm on a win7 host running VS2010 express c++ edition. I've followed the directions per the log4cxx directions ( ) including downloading apr
and apr-util and motifying the .hw files, but I unfortunately, when ever I try to load the log4cxx.dsw solution and convert it to the current VS, I receive an error trying to build apr.apr/dsw and a bunch of other dependent .dsw files. Any suggestions?
Specifically, what I am seeing is:
The Project file 'C:\...projects\apr-util\xml\expat\lib\xml.dsp' cannot be loaded. Do you want to remove the unloadable project from the solution?
I see this for a bunch of other .dsp files.
then in the output box in VC:
C:\Users\x\Documents\Visual Studio 2010\Projects\apr\apr.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apr-util\xml\expat\lib\xml.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apr-util\aprutil.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apache-log4cxx-0.10.0\projects\log4cxx.dsp : error : Project upgrade failed.
Thanks
The files are in the correct path.
You have to follow these steps to get log4cxx (Version 0.10.0) working with VS2010:
Download the latest log4cxx package from here
Download apr and apr-util ZIP packages from here
Extract log4cxx, apr und apr-util to the same directory
Rename the apr_VERSION and apr-util_VERSION folder to apr and apr-util resulting in a directory with three folder: apache-log4cxx-0.10.0, apr and apr-util
Change into the log4cxx directory and execute configure.bat
Change to apr-util/include direcotry and open apu.hw in a texteditor of your choice
Find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file
Open apr_ldap.hw from the same directory and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Change to log4cxx/projects directory and open log4cxx.dsw with VS2010. Answer the converting prompts of VS2010 with yes/ok for each project (apr, apr-util, log4cxx, xml)
Ok if you hit build now then you will see around 2000 errors and that is where the interesting and "hard" part starts:
Ctrl+F and find each entry of the "LOG4CXX_LIST_DEF" macro. You have to move these entries out of its related class and right before the same class. Sometimes you need to move a typedef too or add the class right before the macro.
Some examples:
// telnetadapter.h
...
typedef log4cxx::helpers::SocketPtr Connection;
LOG4CXX_LIST_DEF(ConnectionList, Connection);
class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
...
// appender.h
...
class Appender;
LOG4CXX_PTR_DEF(Appender);
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr);
class Layout;
typedef log4cxx::helpers::ObjectPtrT<Layout> LayoutPtr;
...
class LOG4CXX_EXPORT Appender :
public virtual spi::OptionHandler
{
...
If the compiler complains about KeySet not being member of LoggingEvent, just remove the scope (since we moved the type to outside the class in the previous step, these types no longer are inside the class)
Example:
// old
LoggingEvent::KeySet set;
// new
KeySet set;
If the compiler complains about insert_iterator not being in the namespace std, add #include <iterator> to the include section of the source file.
Last but not least, right-click on log4cxx project and select Add References and select the other 3 projects as reference
Hope this helps you and some others :) ... if you need the whole solution or other files, let me know!
I figured out these steps with the enormous help of this blog entry by Lex LI.
EDIT:
You can download my VS2010 solution and source code from my dropbox:
https://www.dropbox.com/s/rn5d0044jzgzwyf/log4cxx_vs2010.7z
People have successfully converted log4cxx in 2 steps:
original (VS 6) to VS 2008
VS 2008 to VS 2010
Thankfully, someone has made log4cxx 0.10 available as a Visual Studio 2008 project at http://www.dreamcubes.com/webdrive/log4cxx_win32/log4cxx-0.10.0-vc2008-June2008.rar. I've built the project successfully with VS 2010 Express.
Chapter 1 Official Steps
We are going to follow the steps here, http://logging.apache.org/log4cxx/building/vstudio.html. However, we must make changes to adapt to windows/VS201*.
download later version of log4cxx which is apache log4cxx 0.10 from here, http://logging.apache.org/log4cxx/download.html
download dependencies from https://archive.apache.org/dist/apr/
The official building guideline is quite easy to follow:
unzip apr-1.2.11-win32-src.zip
rename apr-1.2.11 apr
unzip apr-util-1.2.10-win32-src.zip
rename apr-util-1.2.10 apr-util
cd apache-log4cxx-0.10.0
configure
configure-aprutil
i recommand you install gow in your developer machine, then you'll have many unix/linux like tools, very convenient. or if you have git, you can add git cmd tools into your env.
configure
configure-aprutil
above 2 cmd requires sed.exe, install it (gow/git) before execute them.
or you can change apu.hw and apr_ldap.hw manually:
Open apr_ldap.hw and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Open apu.hw and find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file
Chapter 2 Building Log4cxx
Now we have to convert *.dsw to *.cxproj. To make it smooth, just launch Visual Studio 201* and open log4cxx.dsw. VS will ask if you like to convert everything. Simply click Yes.
Set log4cxx as startup project.
Open project log4cxx's properties window, add other 3 projects as references, in here:
properties -> common properties -> framework and references .
Hit F7, if you see error c2252, this is because LOG4CXX_LIST_DEF define error, go to its definition and change it to
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
like this,
old:
#define LOG4CXX_LIST_DEF(N, T) \
template class LOG4CXX_EXPORT std::allocator<T>; \
template class LOG4CXX_EXPORT std::vector<T>; \
typedef std::vector<T> N
new:
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
and u will meet another err about insert_iterator, simply add #include< iterator> to relative file
Done! enjoy your log4cxx!
To build log4cxx on Windows 7 64-bit with Visual Studio 2015, I had to do a few steps in addition to Scott's answer, and have some clarifications.
Download the latest log4cxx (apache 0.10.0) ZIP package from here.
Download apr and apr-util ZIP packages from here.
Extract log4cxx, apr, and apr-util to the same directory.
From the official instructions and seveves's answer:
Rename the apr_VERSION and apr-util_VERSION folder to apr and apr-util resulting in a directory with three folder: apache-log4cxx-0.10.0, apr and apr-util
From a Visual Studio command line, cd to the log4cxx directory and execute "configure". This will not work from a git bash shell in case you are trying to use that for the next step.
The next script requires sed, so you have some options:
Edit the files manually as described in the other answers.
Change to apr-util/include directory and open apu.hw in a texteditor of your choice. Find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file. Open apr_ldap.hw from the same directory and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Install sed from GNUWin32 and add it to your PATH, then run "configure-aprutil" from the log4cxx directory from a Windows command prompt.
Use the sed that comes with a Windows git installation by running "configure-aprutil" from the log4cxx directory from a Git Bash prompt.
Open Visual Studio 2015. Open the project log4cxx.dsw from the projects directory. Let Visual Studio convert it.
Set log4cxx as the startup project and check that the other 3 projects show up as dependencies (Right click -> Build Dependencies -> Project Dependencies)
Now I had three of the projects showing up with "(Visual Studio 2010)" next to them. This caused a link error later due to changes in stdio:
4>apr-1.lib(start.obj) : error LNK2001: unresolved external symbol __imp__wenviron
4>apr-1.lib(start.obj) : error LNK2001: unresolved external symbol __imp__environ
4>apr-1.lib(filedup.obj) : error LNK2019: unresolved external symbol __imp___iob_func referenced in function apr_file_dup2
Change this by going to the Properties for each project and changing the "Platform Toolset" for all configurations to Visual Studio 2015.
The solution is now configured for 32-bit. Go to Build > Configuration Manager. Change the platform to x64. Three of the projects will change but log4cxx still says Win32. Click on that and go to New... Add x64 and uncheck "Create new solution platform". Click OK. Make sure "Build" is checked for all 4 projects.
If you build now, you will see the c2252 template errors. Open log4cxx.h
Change line containing "#if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)" to "#if defined(_MSC_VER) && _MSC_VER < 1700 && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)".
Change line containing "#elif defined(_MSC_VER) && !defined(LOG4CXX_STATIC)" to "#elif defined(_MSC_VER) && _MSC_VER < 1700 && !defined(LOG4CXX_STATIC)".
The next error will be about insert_iterator in stringhelper.cpp. Add #include <iterator> to that file.
Then there is a link error:
apr-1.lib(rand.obj) : error LNK2019: unresolved external symbol __imp__UuidCreate
To fix this, go to log4cxx Properties > Linker > Input and add rpcrt4.lib
Now the solution should build and and the library will link to your 64-bit application. Repeat for Debug/Release configurations if you were only editing one.
(Optional) The solution doesn't add the common "d" suffix to the debug library. To add it, open up the Properties for the Debug configuration. Go to Linker > General > Output file and reset to default. Go to Linker > Advanced > Import Library and reset to default. Do this for the Release configuration as well so that they will build to corresponding directories. For only the Debug configuration, go to General, and add a "d" at the end of the Target Name.
Related
In its new version 2017b, Matlab has released a new MATLAB Engine API for C++: https://fr.mathworks.com/help/matlab/calling-matlab-engine-from-cpp-programs.html
When I try to use this API, (only to start Matlab at the beginning !!), I have an issue using :
std::unique_ptr<MATLABEngine> matlabPtr = startMATLAB();
The compilation is ok, but at the execution :
Here is the call stack:
matlab::engine::initSession --> matlab::engine::startMATLAB -->
matlab::engine::startMATLABAsync --> engine_create_session
Now, I use a different way to do my job, but I don't want to let an issue without a solution. Can someone spot the problem with this API?
My configuration :
Matlab 2017b
Visual Studio 2017
Windows 10
Just a few days back, I had the same issue: here
So, I had raised a ticket in MATLAB for technical support. And they suggested to build the project in the following manner which works for me:
Create a project and add the source file.
Go to the project properties, and do the following changes(Make sure to change the architecture to X64):
Under C/C++ General, add the following directory to the field
ADDITIONAL INCLUDE DIRECTORIES: C:\Program Files\MATLAB\\extern\include
Under C/C++ Precompiled Headers, select "Not Using Precompiled
Headers".
Under Linker General, add the directory to the field ADDITIONAL
LIBRARY DIRECTORIES: C:\Program
Files\MATLAB\\extern\lib\win64\microsoft
e. Under Configuration Properties ->Debugging Add the following 2
Target paths in the Environment: PATH=C:\Program
Files\MATLAB\\bin\win64; PATH=C:\Program
Files\MATLAB\\extern\bin\win64;
Under Linker Input, add the following names to the field marked ADDITIONAL DEPENDENCIES:
libmat.lib
libMatlabEngine.lib
libMatlabDataArray.lib
Make sure that the following directory is in the Windows system
environment PATH: C:\Program Files\MATLAB\\bin\win64;
C:\Program Files\MATLAB\\extern\bin\win64
Now, build the project and run your application.
Like in the comment, I solved the issue by upgrading Matlab from R2017b to R2018b!
I noticed the same issue testing R2020b
while it worked fine with R2020a, a run-time error occurs with R2020b when running
std::unique_ptr matlabPtr = startMATLAB();
I am struggling to call MATLAB from a simple .cpp program despite the many resources online for this problem.
My Objective:
Use Microsoft Visual Studio 2010 Professional 64-bit to build .cpp program that
calls MATLAB Engine for built-in functions and graphs (MATLAB R2013b 64-bit)
What I have done:
In the .cpp file property pages, I have:
1) Changed the platform to Active(x64)
2) Added the following paths to the VC++ Directories
Executable Directories: C:\Program Files\MATLAB\R2013b\bin
Include Directories: C:\Program Files\MATLAB\R2013b\extern\include
Reference Directories: C:\Program Files\MATLAB\R2013b\bin\win64
Library Directories: C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft
Path Edits
3) Wrote the following program:
// mEng.cpp : Defines the entry point for the console application.
// libeng.dll is in C:\Program Files\MATLAB\R2013b\bin\win64
#include "stdafx.h"
#include <Engine.h>
#include <matrix.h>
#include <iostream>
#include <string>
#include <cmath>
#pragma comment (lib, "libmat.lib")
#pragma comment (lib, "libmx.lib")
#pragma comment (lib, "libmex.lib")
#pragma comment (lib, "libeng.lib")
#pragma comment (lib, "libut.lib")
using namespace std;
int main()
{
Engine *m_pEngine;
if (!(m_pEngine = engOpen("")))
{
fprintf(stderr, "\nCan't start MATLAB engine\n");
return EXIT_FAILURE;
}
//Now call the MATLAB script through MATLAB Engine
engEvalString(m_pEngine, "script");
cout << "Hit return to continue\n\n";
fgetc(stdin);
//Close the MATLAB Engine
engClose(m_pEngine);
return EXIT_SUCCESS;
}
Errors received:
“The program can’t start because libeng.dll is missing from your computer. Try reinstalling the program to fix this problem.”
I faced the same problem and spent one day to solve it.
So here is my answer.
Actually you overdefine different directories (see the "Path Edits" link).
It is enough to made just these:
Project Properties -> VC++ Directories -> Library Directories. Add here path C:\Program Files\MATLAB\R2016a\bin\win64 (version and path can differ, but the idea is to est path to the same folder of your MATLAB)
Project Properties -> C/C++ -> General -> Additional Include Directories. Add path C:\Program Files\MATLAB\R2016a\extern\include (your path of this folder)
Project Properties -> Linker -> General -> Additional Library Directories. Add path C:\Program Files\MATLAB\R2016a\extern\lib\win64\microsoft
Project Properties -> Linker -> Input -> Additional Dependencies. Add here: libeng.lib; libmx.lib;
And the last and the most important: add the path of MATLAB Engine dll libraries to your Windows. This step solve your problem. We can do it this way: My Computer -> right click: Settings. Opened window System. Left bottom corner: Advanced System Settings
Advanced Tab
In the Environment variables for your user press Create... button and add this one:
Variable name: PATH
Variable value: C:\Program Files\MATLAB\R2016a\bin\win64
This path is reference on where is your libeng.dll located.
Important moment: it can require to restart VS or even restart computer.
Hope it helps some people, who start to work in MATLAB and C++!
Follow my notes here:
https://www.mathworks.com/matlabcentral/answers/100603-how-can-i-compile-a-matlab-engine-application-using-microsoft-visual-studio-9-0-or-10-0
I would like to take this opportunity though to re-format the instructions given there:
To compile a MATLAB engine application in the Microsoft Visual Studio 9.0 (2008) or Microsoft Visual Studio 10.0 (2010) environments, perform the steps outlined below:
Open Microsoft Visual Studio and select
File->New->Project
and then select:
Visual C++ -> General -> Empty Project
Following this, enter the name of the project and its location in the
indicated text areas and click OK.
Note be very careful with this step as it will create the solution folder and
put a project folder in there, so you won't want to set this up, get it all
working and then change the folder as that will break the solution and you'll
have to start all over.
Right-click on the SOURCE FILES folder in the SOLUTION EXPLORER and click
Add -> "New Item..."
Choose "C++ file (.cpp)", enter the name of the file
(as enginedemo.cpp) as you wish. Click OK.
Copy the code from the source file: engwindemo.c, and paste it into this
file enginedemo.cpp. The file engwindemo.c may be obtained from the following
location:
$MATLABROOT/extern/examples/eng_mat
where $MATLABROOT is the MATLAB root directory, and may be determined by
entering the command:
matlabroot
at the MATLAB command prompt.
I'd suggest that at this point you open it in Notepad and if it has some
weird format, fix and save it so it looks like a normal C file when you open
it in Notepad (or gedit or whatever).
This is where things change in Visual Studio and I hope this extends somewhat
transparently to VS Code, Eclipse, or whatever IDE you'd like to use.
So I will re-number the property change section in roman numerals and fix the
order.
Also be sure to hit ENTER and then APPLY after making every change.
Make sure of the change before you go to the next section.
Double-check the spelling and MAKE SURE the directories exist on your
platform.
Go into the Solution Explorer view, Right click on the project name and
select PROPERTIES in the solution explorer to open the project properties.
Once this window has opened, make the following changes:
Go to the Configurations bar at the top of the property page.
You most definitely want to start with this setting.
Pick a configuration, debug or release, or "all configs" if you want the
changes to apply to BOTH debug and release, or you will have to do them all
over again for the other configuration. Which may not be such a bad idea, as
the individual release options are often more "optimized" versions of the
corresponding debug options. Note you can run
into serious trouble changing the property values while switching between
debug and release modes, don't be surprised if the IDE crashes, the solution
database gets corrupt, even the debug won't build and you have
to start all over. Get the debug to work first, back-up the entire solution,
then "clone" the debug settings to release, and then tweak the release
settings one at a time, making sure that the code still builds and runs
between each change.
If compiling to 64-bit Windows, change the target from x86 to x64 & use 64-
bit DLLs and library files.
If this is not in the Configuration options at the very top where it says
"Configuration Manager" (as in VS2015), then follow your IDE instructions...
as mentioned on the following link:
https://www.microsoft.com/en-us/download/details.aspx?id=55984
Under
Configuration Properties ->Debugging
Add the following Target path in the Environment:
(for 32 bit MATLAB)
PATH=$matlabroot\bin\win32
(for 64-bit MATLAB)
PATH=$matlabroot\bin\win64 If you want to use an absolute path instead,
use the following (with a semicolon at the end)
PATH=C:\Program Files\MATLAB\R2013a\bin\win32; (for 32 bit MATLAB)
PATH=C:\Program Files\MATLAB\R2013a\bin\win64; (for 64 bit MATLAB)
(probably can skip the "PATH=" here as it doesn't seem to remain there,
otherwise this is straight from the MATLAB reference )
Under C/C++ General, add the following directory to the field ADDITIONAL
INCLUDE DIRECTORIES:
$MATLABROOT\extern\include
i.e.
c:\Program Files\MATLAB\R2019a\extern\include;
Put a semicolon at the end of every line that you enter that is a path. after
the .lib files in that section also.
Under C/C++ Precompiled Headers, select "Not Using Precompiled Headers".
(in release mode this was set to "yes")
Under Linker General, add the library directory to the field ADDITIONAL
LIBRARY DIRECTORIES:
(For 32-bit Windows)
$MATLABROOT\extern\lib\win32\microsoft
(For 64-bit Windows)
$MATLABROOT\extern\lib\win64\microsoft
i.e.
c:\Program Files\MATLAB\Rxxxxx\extern\lib\win(32|64)\microsoft;
Under Linker Input, add the following library names to the field marked
ADDITIONAL DEPENDENCIES:
(use this string in front of whatever else is in there)
libeng.lib;libmat.lib;libmx.lib;
I don't know if the order really matters, but the original reference listed
them in reverse alphabetical order. "I've heard it both ways".
Ok, now you're done changing the VS project property pages, save the changes
(as you've done all along by clicking "Apply" after each change) and click
Ok. The property pages window will close. At this point your code will build
but still won't call Matlab. Back-up the solution again.
Now change the DOS/WINDOWS ENVIRONMENT PATH STRING.
I would save the solution, close VS, back it up, make the PATH changes and
reopen VS and try to build your program and run it and have it work.
The PATH string must be changed so that the bin\win(32:64) directory is the
first instance related to Matlab on the path.
Go in the "advanced system settings" \ Environment
To do this, check the Windows system path by clicking on Start -> Right click
on Computer -> Properties -> Advanced System Settings -> Environment
variables -> System Variables -> Open "Path" for editing.
and modify the PATH variable as so:
Make sure that the following directory is in the PATH:
(For 32-bit Windows)
$MATLABROOT\bin\win32
(For 64-bit Windows)
$MATLABROOT\bin\win64
It does not have to be the first directory in the path, but it needs to be
the first MATLAB directory in the path
PATH=c:\;....;c:\Program Files\MATLAB\Rxxxxx\bin\win(32/64);
The matlab.exe is in \bin; you might want that on the path also just not
before the \bin\win64 entry...
Note: If the machine has more than one MATLAB installed, the directory for
the target platform must be ahead of any other MATLAB directory (for
instance, when compiling a 64-bit application, the directory in the MATLAB
64-bit installation must be the first one on the PATH).
Also make sure that your target install of
MATLAB is registered as a COM server:
https://www.mathworks.com/help/matlab/ref/regmatlabserver.html
For Matlab 2020a & later, try comserver('query') and comserver('register').
For 2019 & earlier use regmatlabserver() (run Matlab as administrator).
Build and execute the application.
So I include a simple app that should demonstrate the functionality:
#include "stdafx.h"
#include "engine.h"
#include
using namespace std;
int main()
{
Engine *eng;
eng=engOpen(""); // put a breakpoint here
cout << "...now you see it...\n"
engClose(eng); // put a breakpoint here
cout << "...now you don't!\n"
return 0;
}
I have an existing wxWidgets project which I am trying to compile under Visual Studio 2010 (the project was created probably with older version of Visual Studio - could be even VS2003). I compiled wxWidgets library (also included paths in my project). When compiling my project now, I get this error:
1>------ Build started: Project: Terminals, Configuration: Debug Win32 ------
1>Build started 8/24/2015 10:56:23 AM.
1>InitializeBuildStatus:
1> Touching "Debug\Terminals.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ResourceCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>Link:
1> All outputs are up-to-date.
1>Manifest:
1>
1>wx\msw\wx.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the path specified.
1>
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.59
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Can someone help?
This happens if your project's path has a space in it, for example in my case the project is within my Windows account, so the path begins with "C:\Users\Adam Reece...". I then get "C:\Users\Adam" within a "cannot find" like error when building the manifest.
This is 100% a bug with Visual Studio recently of which Microsoft refuses to recognise. You are not in the wrong for having a space in your path as it's been supported since Windows 95. However as a workaround you either need to make sure there are no spaces in the full path to your project, or disable generation of the manifest. (Project properties -> Linker -> Manifest File -> Generate Manifest -> Change to No (/MANIFEST:NO).)
Based on your description, I suggest you to validate your manifest file and make sure it is correct. You can use Manifestchk.vbs or “ mt.exe -manifest 1.manifest -validate_manifest “.
Moreover, from your error message, you need make sure the complier can find your manifest file configure your configuration correctly.
Go to “Configuration Properties -> Linker -> Manifest File”; turn the
“Generate Manifest” to “No”.
Go to “Configuration Properties -> Manifest Tool “; add your manifest
file path, like: (give mainfest file name like “f:/xxxx.manifest”) to
“Additional Manifest Files”; and turn the “Embed Manifest” to “No”.
Eventually, rebuild again.
If you have any more questions, please feel free to let me know.
This error message always happen when Visual Studio could not find the file. There are some potential causes:
Numbers or spaces in the project name
Project name too long
Started creating the project from a blank project that doesn't have
all of the parts.
I'd suggest trying each of the following to see if it fixes the issue- but backup your project/solution directory first.
A) Clean and rebuild the solution
B) Right click on the solution for the project (in Solution Explorer) and rename the solution to a very simple name (e.g., soln). Then do the same for the project (e.g., rename to proj). Do a rebuild all and see if the problem goes away. If it does you can rename the solution and project to something more meaningful.
C) Right click on the project and open it's properties. Go To Link | Manifest and turn off use of the manifest. Rebuild.
D) Create a new Win32 console project. Have Visual Studio create the initial CPP and .H files you need. Open your old source files and copy the code from those into the new files. Rebuild the new project.
I had the same problem and found the solution that DOES NOT require creating a new user profile...
Yes, it is caused by spaces in usernames. But why? Because mt.exe uses TEMP/TMP environment variables. On one of my machines, the username was with the old 8.3 format in TEMP (C:\users\gerson~1) and that worked. This gave me a hint as to how to adress the problem:
set your users' TEMP to some folder that has no spaces
set your users' TMP to some folder that has no spaces
Ensure you restart VS so that the settings changes take effect. Your build should work now ;)
I had this error together with msb3073. I solved the issue by modifying the project's vcxproj file, changing from:
<PostBuildEvent>
<Command>mt.exe -manifest DesignedForWindows7.manifest -i [...]
</Command>
</PostBuildEvent>
to
<AfterBuildEvent>
<Command>mt.exe -manifest DesignedForWindows7.manifest -i [...]
</Command>
</AfterBuildEvent>
where, in place of [...], there is some command line code that I just copied-pasted.
Be careful that there might be more than one such code block in the vcxproj file
UPDATE 02/07/21: Found a solution for Win10.0..... SDK
https://stackoverflow.com/a/49276285/16360714
I got c1010070: Failed to load and parse the manifest
because my Windows User Profile had a space in it e.g. C:\Users\ John Doe\ and I was trying to use UE4 with C++ and Visual Studio 2017, Win 8.1 SDK
FINAL SOLUTION AT END
Solution 0: CHange TMP and TEMP Windows environment variables to folders with no space. This could break other programs. I kept it changed though while trying other solutions.
Solution 1: Exclude C\User\John Doe ... folders from the project
Solution 2: Try to change your Windows Profile Folder Name (tutorials on YouTube)
Solution 3: Create a new Windows local account with no whitespace and use it for dev
Solution 1 Explanation
If you are using UE4, Makefile will be your Project Configuration default. So you won't have access to Linker or Manifest Tool Settings.
I was getting the following errors when building:
Severity Code Description Project File Line Suppression State
Error c1010070 Failed to load and parse the manifest. The system cannot find the file specified. VirtuPilotv3 C:\Users\John
Severity Code Description Project File Line Suppression State
Error LNK1327 failure during running mt.exe VirtuPilotv3 K:\VRDEVELOPMENT\Virtu-Pilot\Intermediate\ProjectFiles\LINK 1
1
Severity Code Description Project File Line Suppression State
Error MSB3073 The command "K:\VRDEVELOPMENT\UE_4.26\Engine\Build\BatchFiles\Build.bat VirtuPilotv3Editor Win64 Development -Project="K:\VRDEVELOPMENT\Virtu-Pilot\VirtuPilotv3.uproject" -WaitMutex -FromMsBuild" exited with code 6. VirtuPilotv3 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 44
I noticed the Macro $(PATH) in Property Page>General>Executable Directories contained a C:\ Users folder path "C:\Users\John Doe.dotnet\tools" to be specific.
So I added the .dotnet folder to my exclude directories and BINGO! I could build and open the editor. [1 VISUAL STUDIO WARNING]
Discovered C:\Users\John Doe.dotnet\tools is found under Windows "path"Environment Path Variables Image variable
I'll probably make a copy of the .dotnet folder to something like C:\VisualStudioCustom and add that folder as Windows Path New .dotnet folder set as path. This Should Solve the problem for all projects. As the new folder will automatically get added to Visual Studios Macro $(PATH). [IT ACTUALLY WORKED, NO VS ERRORS]
This is driving me crazy, I'm trying to building the log4cxx library in order to use in a c++ project I've been using. I'm on a win7 host running VS2010 express c++ edition. I've followed the directions per the log4cxx directions ( ) including downloading apr
and apr-util and motifying the .hw files, but I unfortunately, when ever I try to load the log4cxx.dsw solution and convert it to the current VS, I receive an error trying to build apr.apr/dsw and a bunch of other dependent .dsw files. Any suggestions?
Specifically, what I am seeing is:
The Project file 'C:\...projects\apr-util\xml\expat\lib\xml.dsp' cannot be loaded. Do you want to remove the unloadable project from the solution?
I see this for a bunch of other .dsp files.
then in the output box in VC:
C:\Users\x\Documents\Visual Studio 2010\Projects\apr\apr.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apr-util\xml\expat\lib\xml.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apr-util\aprutil.dsp : error : Project upgrade failed.
C:\Users\x\Documents\Visual Studio 2010\Projects\apache-log4cxx-0.10.0\projects\log4cxx.dsp : error : Project upgrade failed.
Thanks
The files are in the correct path.
You have to follow these steps to get log4cxx (Version 0.10.0) working with VS2010:
Download the latest log4cxx package from here
Download apr and apr-util ZIP packages from here
Extract log4cxx, apr und apr-util to the same directory
Rename the apr_VERSION and apr-util_VERSION folder to apr and apr-util resulting in a directory with three folder: apache-log4cxx-0.10.0, apr and apr-util
Change into the log4cxx directory and execute configure.bat
Change to apr-util/include direcotry and open apu.hw in a texteditor of your choice
Find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file
Open apr_ldap.hw from the same directory and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Change to log4cxx/projects directory and open log4cxx.dsw with VS2010. Answer the converting prompts of VS2010 with yes/ok for each project (apr, apr-util, log4cxx, xml)
Ok if you hit build now then you will see around 2000 errors and that is where the interesting and "hard" part starts:
Ctrl+F and find each entry of the "LOG4CXX_LIST_DEF" macro. You have to move these entries out of its related class and right before the same class. Sometimes you need to move a typedef too or add the class right before the macro.
Some examples:
// telnetadapter.h
...
typedef log4cxx::helpers::SocketPtr Connection;
LOG4CXX_LIST_DEF(ConnectionList, Connection);
class LOG4CXX_EXPORT TelnetAppender : public AppenderSkeleton
...
// appender.h
...
class Appender;
LOG4CXX_PTR_DEF(Appender);
LOG4CXX_LIST_DEF(AppenderList, AppenderPtr);
class Layout;
typedef log4cxx::helpers::ObjectPtrT<Layout> LayoutPtr;
...
class LOG4CXX_EXPORT Appender :
public virtual spi::OptionHandler
{
...
If the compiler complains about KeySet not being member of LoggingEvent, just remove the scope (since we moved the type to outside the class in the previous step, these types no longer are inside the class)
Example:
// old
LoggingEvent::KeySet set;
// new
KeySet set;
If the compiler complains about insert_iterator not being in the namespace std, add #include <iterator> to the include section of the source file.
Last but not least, right-click on log4cxx project and select Add References and select the other 3 projects as reference
Hope this helps you and some others :) ... if you need the whole solution or other files, let me know!
I figured out these steps with the enormous help of this blog entry by Lex LI.
EDIT:
You can download my VS2010 solution and source code from my dropbox:
https://www.dropbox.com/s/rn5d0044jzgzwyf/log4cxx_vs2010.7z
People have successfully converted log4cxx in 2 steps:
original (VS 6) to VS 2008
VS 2008 to VS 2010
Thankfully, someone has made log4cxx 0.10 available as a Visual Studio 2008 project at http://www.dreamcubes.com/webdrive/log4cxx_win32/log4cxx-0.10.0-vc2008-June2008.rar. I've built the project successfully with VS 2010 Express.
Chapter 1 Official Steps
We are going to follow the steps here, http://logging.apache.org/log4cxx/building/vstudio.html. However, we must make changes to adapt to windows/VS201*.
download later version of log4cxx which is apache log4cxx 0.10 from here, http://logging.apache.org/log4cxx/download.html
download dependencies from https://archive.apache.org/dist/apr/
The official building guideline is quite easy to follow:
unzip apr-1.2.11-win32-src.zip
rename apr-1.2.11 apr
unzip apr-util-1.2.10-win32-src.zip
rename apr-util-1.2.10 apr-util
cd apache-log4cxx-0.10.0
configure
configure-aprutil
i recommand you install gow in your developer machine, then you'll have many unix/linux like tools, very convenient. or if you have git, you can add git cmd tools into your env.
configure
configure-aprutil
above 2 cmd requires sed.exe, install it (gow/git) before execute them.
or you can change apu.hw and apr_ldap.hw manually:
Open apr_ldap.hw and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Open apu.hw and find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file
Chapter 2 Building Log4cxx
Now we have to convert *.dsw to *.cxproj. To make it smooth, just launch Visual Studio 201* and open log4cxx.dsw. VS will ask if you like to convert everything. Simply click Yes.
Set log4cxx as startup project.
Open project log4cxx's properties window, add other 3 projects as references, in here:
properties -> common properties -> framework and references .
Hit F7, if you see error c2252, this is because LOG4CXX_LIST_DEF define error, go to its definition and change it to
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
like this,
old:
#define LOG4CXX_LIST_DEF(N, T) \
template class LOG4CXX_EXPORT std::allocator<T>; \
template class LOG4CXX_EXPORT std::vector<T>; \
typedef std::vector<T> N
new:
#define LOG4CXX_LIST_DEF(N, T) typedef std::vector<T> N
and u will meet another err about insert_iterator, simply add #include< iterator> to relative file
Done! enjoy your log4cxx!
To build log4cxx on Windows 7 64-bit with Visual Studio 2015, I had to do a few steps in addition to Scott's answer, and have some clarifications.
Download the latest log4cxx (apache 0.10.0) ZIP package from here.
Download apr and apr-util ZIP packages from here.
Extract log4cxx, apr, and apr-util to the same directory.
From the official instructions and seveves's answer:
Rename the apr_VERSION and apr-util_VERSION folder to apr and apr-util resulting in a directory with three folder: apache-log4cxx-0.10.0, apr and apr-util
From a Visual Studio command line, cd to the log4cxx directory and execute "configure". This will not work from a git bash shell in case you are trying to use that for the next step.
The next script requires sed, so you have some options:
Edit the files manually as described in the other answers.
Change to apr-util/include directory and open apu.hw in a texteditor of your choice. Find the entry #define APU_HAVE_APR_ICONV, set it to 0 and save the file. Open apr_ldap.hw from the same directory and find the entry #define APR_HAS_LDAP, set it to 0 and save the file, too.
Install sed from GNUWin32 and add it to your PATH, then run "configure-aprutil" from the log4cxx directory from a Windows command prompt.
Use the sed that comes with a Windows git installation by running "configure-aprutil" from the log4cxx directory from a Git Bash prompt.
Open Visual Studio 2015. Open the project log4cxx.dsw from the projects directory. Let Visual Studio convert it.
Set log4cxx as the startup project and check that the other 3 projects show up as dependencies (Right click -> Build Dependencies -> Project Dependencies)
Now I had three of the projects showing up with "(Visual Studio 2010)" next to them. This caused a link error later due to changes in stdio:
4>apr-1.lib(start.obj) : error LNK2001: unresolved external symbol __imp__wenviron
4>apr-1.lib(start.obj) : error LNK2001: unresolved external symbol __imp__environ
4>apr-1.lib(filedup.obj) : error LNK2019: unresolved external symbol __imp___iob_func referenced in function apr_file_dup2
Change this by going to the Properties for each project and changing the "Platform Toolset" for all configurations to Visual Studio 2015.
The solution is now configured for 32-bit. Go to Build > Configuration Manager. Change the platform to x64. Three of the projects will change but log4cxx still says Win32. Click on that and go to New... Add x64 and uncheck "Create new solution platform". Click OK. Make sure "Build" is checked for all 4 projects.
If you build now, you will see the c2252 template errors. Open log4cxx.h
Change line containing "#if defined(_MSC_VER) && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)" to "#if defined(_MSC_VER) && _MSC_VER < 1700 && !defined(LOG4CXX_STATIC) && defined(LOG4CXX)".
Change line containing "#elif defined(_MSC_VER) && !defined(LOG4CXX_STATIC)" to "#elif defined(_MSC_VER) && _MSC_VER < 1700 && !defined(LOG4CXX_STATIC)".
The next error will be about insert_iterator in stringhelper.cpp. Add #include <iterator> to that file.
Then there is a link error:
apr-1.lib(rand.obj) : error LNK2019: unresolved external symbol __imp__UuidCreate
To fix this, go to log4cxx Properties > Linker > Input and add rpcrt4.lib
Now the solution should build and and the library will link to your 64-bit application. Repeat for Debug/Release configurations if you were only editing one.
(Optional) The solution doesn't add the common "d" suffix to the debug library. To add it, open up the Properties for the Debug configuration. Go to Linker > General > Output file and reset to default. Go to Linker > Advanced > Import Library and reset to default. Do this for the Release configuration as well so that they will build to corresponding directories. For only the Debug configuration, go to General, and add a "d" at the end of the Target Name.
How to get from C/C++ extension source code to a pyd file for windows (or other item that I could import to Python)?
edit: The specific library that I wanted to use (BRISK) was included in OpenCV 2.4.3 so my need for this skill went away for the time being. In case you came here looking for BRISK, here is a simple BRISK in Python demo that I posted.
I have the Brisk source code (download) that I would like to build and use in my python application. I got as far as generating a brisk.pyd file... but it was 0 bytes. If there is a better / alternative way to aiming for a brisk.pyd file, then of course I am open to that as well.
edit: Please ignore all the attempts in my original question below and see my answer which was made possible by obmarg's detailed walkthrough
Where am I going wrong?
Distutils without library path: First I tried to build the source as is with distutils and the following setup.py (I have just started learning distutils so this is a shot in the dark). The structure of the BRISK source code is at the bottom of this question for reference.
from distutils.core import setup, Extension
module1 = Extension('brisk',
include_dirs = ['include', 'C:/opencv2.4/build/include', 'C:/brisk/thirdparty/agast/include'],
#libraries = ['agast_static', 'brisk_static'],
#library_dirs = ['win32/lib'],
sources = ['src/brisk.cpp'])
setup (name = 'BriskPackage',
ext_modules = [module1])
That instantly gave me the following lines and a 0 byte brisk.pyd somewhere in the build folder. So close?
running build
running build_ext
Distutils with library path: Scratch that attempt. So I added the two library lines that are commented out in the above setup.py. That seemed to go ok until I got this linking error:
creating build\lib.win32-2.7
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:win32/lib /LIB
PATH:C:\Python27_32bit\libs /LIBPATH:C:\Python27_32bit\PCbuild agast_static.lib brisk_static.lib /EXPORT:initbrisk build
\temp.win32-2.7\Release\src/brisk.obj /OUT:build\lib.win32-2.7\brisk.pyd /IMPLIB:build\temp.win32-2.7\Release\src\brisk.
lib /MANIFESTFILE:build\temp.win32-2.7\Release\src\brisk.pyd.manifest
LINK : error LNK2001: unresolved external symbol initbrisk
build\temp.win32-2.7\Release\src\brisk.lib : fatal error LNK1120: 1 unresolved externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe"' failed with exit status 1120
Uncontrolled flailing: I thought maybe the libraries needed to be built, so I did a crash course (lots of crashing) with cmake + mingw - mingw + vc++ express 2010 as follows:
cmake gui: source: c:/brisk, build: c:/brisk/build
cmake gui: configure for Visual Studio 10
cmake gui: use default options and generate (CMAKE_BACKWARDS_COMPATIBILITY, CMAKE_INSTALL_PREFIX, EXECUTABLE_OUTPUT_PATH, LIBRARY_OUTPUT_PATH)
VC++ Express 10: Change to Release and build the solution generated by cmake and get about 20 pages of what look like non-critical warnings followed by all succeeded. Note - no dlls are generated by this. It does generate the following libraries of similar size to the ones included with the download:
win32/lib/Release/
agast_static.lib
brisk_static.lib
Further flailing.
Relevant BRISK source file structure for reference:
build/ (empty)
include/brisk/
brisk.h
hammingsse.hpp
src
brisk.cpp
demo.cpp
thirdparty/agast/
include/agast/
agast5_8.h ....
cvWrapper.h
src/
agast5_8.cc ...
CMakeLists.txt
win32/
bin/
brisk.mexw32
opencv_calib3d220.dll ...
lib/
agast_static.lib
brisk_static.lib
CMakeLists.txt
FindOpenCV.cmake
Makefile
Are you sure that this brisk library even exports python bindings? I can't see any reference to it in the source code - it doesn't even seem to import python header files. This would certainly explain why you've not had much success so far - you can't just compile plain C++ code and expect python to interface with it.
I think your second distutils example is closest to correct - it's obviously compiling things and getting to the linker stage, but then you encounter this error. That error just means it can't find a function named initbrisk which I'm guessing would be the top level init function for the module. Again this suggests that you're trying to compile a python module from code that isn't meant for it.
If you want to wrap the C++ code in a python wrapper yourself you could have a look at the official documentation on writing c/c++ extensions. Alternatively you could have a look into boost::python, SIP or shiboken which try to somewhat (or completely) automate the process of making python extensions from C++ code.
EDIT: Since you seem to have made a decent amount of effort to solve the problem yourself and have posted a good question, I've decided to give a more detailed response on how to go about doing this.
Quick Tutorial On Wrapping C++ Libraries Using boost::python
Personally I've only ever used boost::python for stuff like this, so I'll try and give you a good summary of how to go about doing that. I'm going to assume that you're using Visual C++ 2010. I'm also going to assume that you've got a 32bit version of python installed, as I believe the boost pro libraries only provide 32bit binaries.
Installing boost
First you'll need to grab a copy of the boost library. The easiest way to do this is to download an installer from the boost pro website. These should install all the header files and binary files that are required for using the boost c++ library on windows. Take note of where you install these files to, as you'll need them later on - it might be best to install to a path without a space in it. For easyness I'm going to assume you put these files in C:\boost but you can substitute that for the path you actually used.
Alternatively, you can follow these instructions to build boost from source. I'm not 100% sure, but it might be the case that you need to do this in order to get a version of boost::python that is compatible with the version of python you have installed.
Setting up a visual studio project
Next, you'll want to setup a visual studio project for brisk.pyd. If you open visual studio, go to New -> Project then find the option for Win32 Project. Set up your location etc. and click ok. In the wizard that appears select a DLL project type, and then tick the empty project checkbox.
Now that you've created your project, you'll need to set up the include & library paths to allow you to use python, boost::python and the brisk.lib file.
In Visual Studios solution explorer, right click on your project, and select properties from the menu that appears. This should open up the property pages for your project. Go to the Linker -> General section and look for the Additional Library Directories section. You'll need to fill this in with the paths to the .lib files for boost, python and your brisk_static.lib. Generally these can be found in lib (or libs) subdirectories of
wherever you've installed the libraries. Paths are seperated with semicolons. I've attached a screenshot of my settings below:
Next, you'll need to get visual studio to link to the .lib files. These sections can be found in the Additional Dependencies field of the Linker -> Input section of the properties. Again it's a semicolon delimited list. You should need to add in libraries for python (in my case this is python27.lib but this will vary by version) and brisk_static.lib. These do not require the full path as you added that in the previous stage. Again, here's a screenshot:
You may also need to add the boost_python library file but I think boost uses some header file magic to save you the trouble. If I'm incorrect then have a look in you boost library path for a file named similar to boost_python-vc100-mt.lib and add that in.
Finally, you'll need to setup the include paths to allow your project to include the relevant C++ header files. To get the relevant settings to appear in project properties, you'll need to add a .cpp file to your project. Right click the source files folder in your solution explorer, and then go to add new item. Select a C++ File (.cpp) and name it main.cpp (or whatever else you want).
Next, go back to your project properties and go to C/C++ -> General. Under the additional libraries directory you need to add the include paths for brisk, python and boost. Again, semicolons for seperators, and again here's a screenshot:
I suspect that you might need to update these settings to include the opencv2 & agast libraries as well but I'll leave that as a task for you to figure out - it should be much the same process.
Wrapping existing c++ classes with boost::python.
Now comes the slightly trickier bit - actually writing C++ to wrap your brisk library in boost python. You can find a tutorial for this here but i'll try and go over it a bit as well.
This will be taking place in the main.cpp file you created earlier. First, add the relevant include statements you'll need at the top of the file:
#include <brisk/brisk.h>
#include <Python.h>
#include <boost/python.hpp>
Next, you'll need to declare your python module. I'm assuming you'd want this to be called brisk, so you do something like this:
BOOST_PYTHON_MODULE(brisk)
{
}
This should tell boost::python to create a python module named brisk.
Next it's just a case of going through all the classes & structs that you want to wrap and declaring boost python classes with them. The declerations of the classes should all be contained in brisk.h. You should only wrap the public members of a class, not any protected or private members. As a quick example, I've done a couple of the structs here:
BOOST_PYTHON_MODULE(brisk)
{
using namespace boost::python;
class_< cv::BriskPatternPoint >( "BriskPatternPoint" )
.def_readwrite("x", &cv::BriskPatternPoint::x)
.def_readwrite("y", &cv::BriskPatternPoint::y)
.def_readwrite("sigma", &cv::BriskPatternPoint::sigma);
class< cv::BriskScaleSpace >( "BriskScaleSpace", init< uint8_t >() )
.def( "constructPyramid", &cv::BriskScaleSpace::constructPyramid );
}
Here I have wrapped the cv::BriskPatternPoint structure and the cv::BriskScaleSpace class. Some quick explanations:
class_< cv::BriskPatternPoint >( "BriskPatternPoint" ) tells boost::python to declare a class, using the cv::BriskPatternPoint C++ class, and expose it as BriskPatternPoint in python.
.def_readwrite("y", &cv::BriskPatternPoint::y) adds a readable & writeable property to the BriskPatternPoint class. The property is named y, and will map to the BriskPatternPoint::y c++ field.
class< cv::BriskScaleSpace >( "BriskScaleSpace", init< uint8_t >() ) declares another class, this time BriskScaleSpace but also provides a constructor that accepts a uint8_t (an unsigned byte - which should just map to an integer in python, but I'd be careful to not pass in one greater than 255 bytes - I don't know what would happen in that situation)
The following .def line just declares a function - boost::python should (I think) be able to determine the argument types of functions automatically, so you don't need to provide them.
It's probably worth noting that I haven't actually compiled any of these examples - they might well not work at all.
Anyway, to get this fully working in python it should just be a case of doing similar for every structure, class, property & function that you want accessible from python - which is potentially quite a time consuming task!
If you want to see another example of this in action, I did this here to wrap up this class
Building & using the extension
Visual studio should take care of building the extension - then using it is just a case of taking the .DLL and renaming it to .pyd (you can get VS to do this for you, but I'll leave that up to you).
Then you just need to copy your python file to somewhere on your python path (site-packages for example), import it and use it!
import brisk
patternPoint = brisk.BriskPatternPoint()
....
Anyway, I have spent a good hour or so writing this out - so I'm going to stop here. Apologies if I've left anything out or if anything isn't clear, but I'm doing this mostly from memory. Hopefully it's been of some help to you. If you need anything clarified please just leave a comment, or ask another question.
In case someone needs it, this what I have so far. Basically a BriskFeatureDetector that can be created in Python and then have detect called. Most of this is just confirming/copying what obmarg showed me, but I have added the details that get all the way to the pyd library.
The detect method is still incomplete for me though since it does not convert data types. Anyone who knows a good way to improve this, please do! I did find, for example, this library which seems to convert a numpy ndarray to a cv::Mat, but I don't have the time to figure out how to integrate it now. There are also other data types that need to be converted.
Install OpenCV 2.2
for the setup below, I installed to C:\opencv2.2
Something about the API or implementation has changed by version 2.4 that gave me problems (maybe the new Algorithm object?) so I stuck with 2.2 which BRISK was developed with.
Install Boost with Boost Python
for the setup below, I installed to C:\boost\boost_1_47
Create a Visual Studio 10 Project:
new project --> win32
for the setup below, I named it brisk
next --> DLL application type; empty project --> finished
at the top, change from Debug Win32 to Release Win32
Create main.cpp in Source Files
Do this before the project settings so the C++ options become available in the project settings
#include <boost/python.hpp>
#include <opencv2/opencv.hpp>
#include <brisk/brisk.h>
BOOST_PYTHON_MODULE(brisk)
{
using namespace boost::python;
//this long mess is the only way I could get the overloaded signatures to be accepted
void (cv::BriskFeatureDetector::*detect_1)(const cv::Mat&,
std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint>>&,
const cv::Mat&) const
= &cv::BriskFeatureDetector::detect;
void (cv::BriskFeatureDetector::*detect_vector)(const std::vector<cv::Mat, std::allocator<cv::Mat>>&,
std::vector< std::vector< cv::KeyPoint, std::allocator<cv::KeyPoint>>, std::allocator< std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint>>>>&,
const std::vector<cv::Mat, std::allocator<cv::Mat>>&) const
= &cv::BriskFeatureDetector::detect;
class_< cv::BriskFeatureDetector >( "BriskFeatureDetector", init<int, int>())
.def( "detect", detect_1)
;
}
Project Settings (right-click on the project --> properties):
Includes / Headers
Configuration Properties --> C/C++ --> General
add to Additional Include Directories (adjust to your own python / brisk / etc. base paths):
C:\opencv2.2\include;
C:\boost\boost_1_47;
C:\brisk\include;C:\brisk\thirdparty\agast\include;
C:\python27\include;
Libraries (linker)
Configuration Properties --> Linker --> General
add to Additional Library Directories (adjust to your own python / brisk / etc. base paths):
C:\opencv2.2\lib;
C:\boost\boost_1_47\lib;
C:\brisk\win32\lib;
C:\python27\Libs;
Configuration Properties --> Linker --> Input
add to Additional Dependencies (adjust to your own python / brisk / etc. base paths):
opencv_imgproc220.lib;opencv_core220.lib;opencv_features2d220.lib;
agast_static.lib; brisk_static.lib;
python27.lib;
.pyd output instead of .dll
Configuration Properties --> General
change Target Extension to .pyd
Build and rename if necessary
Right-click on the solution and build/rebuild
you may need to rename the output from "Brisk.pyd" to "brisk.pyd" or else python will give you errors about not being able to load the DLL
Make brisk.pyd available to python by putting it in site packages or by putting a .pth file that links to its path
Update Path environment variable
In windows settings, make sure the following are included in your path (again, adjust to your paths):
`C:\boost\boost_1_47\lib;C:\brisk\win32\bin`