{"action":"created","issue":{"url":"https://api.github.com/repos/kyamagu/mexopencv/issues/258","repository_url":"https://api.github.com/repos/kyamagu/mexopencv","labels_url":"https://api.github.com/repos/kyamagu/mexopencv/issues/258/labels{/name}","comments_url":"https://api.github.com/repos/kyamagu/mexopencv/issues/258/comments","events_url":"https://api.github.com/repos/kyamagu/mexopencv/issues/258/events","html_url":"https://github.com/kyamagu/mexopencv/issues/258","id":160699190,"number":258,"title":"undefined reference to `cv::Moments::Moments'","user":{"login":"superhans","id":5943164,"avatar_url":"https://avatars.githubusercontent.com/u/5943164?v=3","gravatar_id":"","url":"https://api.github.com/users/superhans","html_url":"https://github.com/superhans","followers_url":"https://api.github.com/users/superhans/followers","following_url":"https://api.github.com/users/superhans/following{/other_user}","gists_url":"https://api.github.com/users/superhans/gists{/gist_id}","starred_url":"https://api.github.com/users/superhans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superhans/subscriptions","organizations_url":"https://api.github.com/users/superhans/orgs","repos_url":"https://api.github.com/users/superhans/repos","events_url":"https://api.github.com/users/superhans/events{/privacy}","received_events_url":"https://api.github.com/users/superhans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-06-16T16:04:00Z","updated_at":"2016-06-17T13:52:31Z","closed_at":null,"body":"When I run your demo code : \r\n\r\n```\r\n#include \"mexopencv.hpp\"\r\nvoid mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])\r\n{\r\n    // Check arguments\r\n    nargchk (nlhs<=1 && nrhs==1);\r\n\r\n    // Convert MxArray to cv::Mat\r\n    cv::Mat mat = MxArray(prhs[0]).toMat();\r\n\r\n    // Do whatever you want\r\n\r\n    // Convert cv::Mat back to mxArray*\r\n    plhs[0] = MxArray(mat);\r\n}\r\n```\r\n\r\nusing the following command : \r\n`mex -L/usr/local/lib -L/homes/Softwares/mexopencv/lib -lopencv_core -lMxArray testMexOpencv.cpp`\r\n\r\nI get the following error : \r\n```\r\nError using mex\r\n/homes/manjunatha/UBUNTU_PANDORA/Softwares/mexopencv/lib/libMxArray.a(MxArray.o): In function `MxArray::toMoments(unsigned long) const':\r\nMxArray.cpp:(.text+0x2c1a): undefined reference to `cv::Moments::Moments(double, double, double, double, double, double, double, double, double, double)'\r\ncollect2: error: ld returned 1 exit status\r\n```\r\n\r\nI'm running Ubuntu 14.04, Matlab 2016a, OpenCV 3.1\r\nWhat do you think is the problem ?\r\n"},"comment":{"url":"https://api.github.com/repos/kyamagu/mexopencv/issues/comments/226774295","html_url":"https://github.com/kyamagu/mexopencv/issues/258#issuecomment-226774295","issue_url":"https://api.github.com/repos/kyamagu/mexopencv/issues/258","id":226774295,"user":{"login":"amroamroamro","id":83908,"avatar_url":"https://avatars.githubusercontent.com/u/83908?v=3","gravatar_id":"","url":"https://api.github.com/users/amroamroamro","html_url":"https://github.com/amroamroamro","followers_url":"https://api.github.com/users/amroamroamro/followers","following_url":"https://api.github.com/users/amroamroamro/following{/other_user}","gists_url":"https://api.github.com/users/amroamroamro/gists{/gist_id}","starred_url":"https://api.github.com/users/amroamroamro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amroamroamro/subscriptions","organizations_url":"https://api.github.com/users/amroamroamro/orgs","repos_url":"https://api.github.com/users/amroamroamro/repos","events_url":"https://api.github.com/users/amroamroamro/events{/privacy}","received_events_url":"https://api.github.com/users/amroamroamro/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T13:52:31Z","updated_at":"2016-06-17T13:52:31Z","body":"The output of `pkg-config` looks correct to me... Just to confirm the right version, please also check:\r\n\r\n``` sh\r\n$ pkg-config --modversion opencv\r\n```\r\n\r\nNow let's try this one more time. Run the following in a shell terminal (all in one line):\r\n\r\n``` sh\r\n$ mex -largeArrayDims -cxx -I/path/to/mexopencv/include `pkg-config --cflags opencv`\r\n   testMexOpencv.cpp -L/path/to/mexopencv/lib -lMxArray `pkg-config --libs opencv`\r\n```\r\n\r\nNote that the order of arguments is important, and the libraries must come after the source/object files. Also note that the linker works from left to right, so put your libraries first (MxArray), followed by their lib dependencies (opencv).\r\n\r\n---\r\n\r\nAs I said before this is correctly done in the makefile, and it should be working as is (we do in fact run [continuous integration](https://travis-ci.org/kyamagu/mexopencv) tests to make sure everything compiles and runs just fine against the latest 3.1.0 version).\r\n\r\nOtherwise I suspect something wrong in your setup, and perhaps you should start over (uninstall both opencv and mexopencv and start fresh).\r\n"}}
{"actor":{"display_login":"amroamroamro"}}