Algomorph/pyboostcvconverter

my makefile, erros

Closed this issue · 14 comments

my makefile, erros

makefile

PYTHON_VERSION = 2.7
PYTHON_INCLUDE = /usr/include/python$(PYTHON_VERSION)

BOOST_INC = /usr/local/include
BOOST_LIB = /usr/local/lib
OPENCV_LIB = $$(pkg-config --libs opencv)
OPENCV_INC = $$(pkg-config --cflags opencv)

TARGET = matmul

$(TARGET).so: $(TARGET).o
g++ -shared -Wl,--export-dynamic $(TARGET).o -L$(BOOST_LIB) -lboost_python -lboost_numpy $(OPENCV_LIB) -L/usr/lib/python$(PYTHON_VERSION)/config -lpython$(PYTHON_VERSION) -o $(TARGET).so

$(TARGET).o: $(TARGET).cpp
g++ -I$(PYTHON_INCLUDE) $(OPENCV_INC) -I$(BOOST_INC) -fPIC -c $(TARGET).cpp

ERRORS

matmul.cpp: In function ‘PyObject* mul(PyObject_, PyObject_)’:
matmul.cpp:12:10: error: ‘c1’ does not name a type
auto c1 = leftMat.cols, r2 = rightMat.rows;
^
matmul.cpp:14:9: error: ‘c1’ was not declared in this scope
if (c1 != r2)
^
matmul.cpp:14:15: error: ‘r2’ was not declared in this scope
if (c1 != r2)
^
matmul.cpp: In function ‘cv::Mat mul2(cv::Mat, cv::Mat)’:
matmul.cpp:31:10: error: ‘c1’ does not name a type
auto c1 = leftMat.cols, r2 = rightMat.rows;
^
matmul.cpp:32:9: error: ‘c1’ was not declared in this scope
if (c1 != r2)
^
matmul.cpp:32:15: error: ‘r2’ was not declared in this scope
if (c1 != r2)
^
matmul.cpp: In function ‘void init_module_matmul()’:
matmul.cpp:51:23: error: ‘XM’ is not a namespace-name
using namespace XM;
^
matmul.cpp:51:25: error: expected namespace-name before ‘;’ token
using namespace XM;
^
make: *** [matmul.o] Error 1

I think in order for auto vars to work, you need to use C++11. Try building with the -std=c++11 flag for g++.

I could use that command But I still having the same issue

El 11/5/2015, a las 13:51, Gregory Kramida notifications@github.com escribió:

I think in order for auto vars to work, you need to use C++11. Try building with the -std=c++11 flag for g++.


Reply to this email directly or view it on GitHub.

What's your GCC version?

I had to switch The pointer of the compiler iam using 4.8

El 11/5/2015, a las 13:53, Gregory Kramida notifications@github.com escribió:

What's your GCC version?


Reply to this email directly or view it on GitHub.

What happens when you replace auto with int? (in all places of the sample code)

Am I save to assume that solved the issue? Can I now close it?

That didnt help

El 11/5/2015, a las 20:49, Gregory Kramida notifications@github.com escribió:

I'm assuming that solved the issue? Can I now close it?


Reply to this email directly or view it on GitHub.

Building with the -std=c++0x flag seems to take care of this error for me.

I am having the same issue and receive the error upon using namespace XM. I have tried using the flags '-std=c++11 -stdlib=libc++' to enable C++11. When I run the command 'g++ --version', I receive the following output:

g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix

Any suggestions?

Hello, gentlemen, I just got back from my vacation. I have an updated version, which should work for OpenCV 2.10+ and OpenCV 3.0 interchangeably. I still need to perform testing with the OpenCV 3.0 + version and incorporate the changes into the repo. The new version uses CMake. Hopefully, that should take of the issue.

@ortizeg , I have been using gcc 4.7 through 4.9 for this. Could outdated gcc includes (4.2) be the issue?

I tried gcc 4.9 and it produced a similar error: "matmul.cpp:51:21: error: 'XM' is not a namespace-name".

Hi @ortizeg,
could you please try out the newer version in the feature/cmake branch?

P.S. you'll need to use cmake to generate the Makefiles. This should simplify things a bit. On *nix systems, something like "sudo make install" will also install the compiled library to the needed folder.

Fixed in a304f8c