I have a custom .msg file MyImage.msg
sensor_msgs/Image im
float32 age
string name
I have configured the custom .msg fle as illustrated in link:CreatingMsgAndSrv
Further, I am trying to write a simple publisher with this msg.
#include <ros/ros.h>
#include <custom_msg/MyImage.h>
#include <image_transport/image_transport.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>
int main( int argc, char ** argv )
{
ros::init(argc, argv, "publish_custom");
ros::NodeHandle nh;
ros::Publisher pub2 = nh.advertise<custom_msg::MyImage>("custom_image", 2 );
cv::Mat image = cv::imread( "Lenna.png", CV_LOAD_IMAGE_COLOR );
sensor_msgs::ImagePtr im_msg = cv_bridge::CvImage(std_msgs::Header(), "bgr8", image).toImageMsg();
ros::Rate rate( 2 );
while( ros::ok() )
{
ROS_INFO_STREAM_ONCE( "IN main loop");
custom_msg::MyImage msg2;
msg2.age=54.3;
msg2.im = im_msg;
msg2.name="Gena";
pub2.publish(msg2);
rate.sleep();
}
}
This does not seem to compile with catkin_make. The error messages are -
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp: In function ‘int main(int, char**)’:
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp:40:19: error: no match for ‘operator=’ in ‘msg2.custom_msg::MyImage_<std::allocator<void> >::im = im_msg’
/home/eeuser/ros_workspaces/HeloRosProject/src/custom_msg/publish.cpp:40:19: note: candidate is:
/opt/ros/hydro/include/sensor_msgs/Image.h:56:8: note: sensor_msgs::Image_<std::allocator<void> >& sensor_msgs::Image_<std::allocator<void> >::operator=(const sensor_msgs::Image_<std::allocator<void> >&)
/opt/ros/hydro/include/sensor_msgs/Image.h:56:8: note: no known conversion for argument 1 from ‘sensor_msgs::ImagePtr {aka boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > >}’ to ‘const sensor_msgs::Image_<std::allocator<void> >&’
make[2]: *** [custom_msg/CMakeFiles/publish.dir/publish.cpp.o] Error 1
make[1]: *** [custom_msg/CMakeFiles/publish.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
I can understand that msg2.im = im_msg; isn't correct. Please help me fix this.
You are trying to assign a sensor_msgs::ImagePtr (a pointer) to a sensor_msgs::Image field. Simply you can't. Just look at the fifth line of your error log:
no known conversion for argument 1 from ‘sensor_msgs::ImagePtr {aka boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > >}’ to ‘const sensor_msgs::Image_<std::allocator<void> >&’
To solve this simple issue, just add the dereference operator (*) to that pointer:
msg2.im = *im_msg;
I assume that there are no other errors in the code.
Related
I was trying to write a parser for a subset of C language . But when I include string or vector inside the %union , it throws error . Using char* or array seems to be fine .
%union{
string s;
vector<int>v;
}
I have seen in some place that it is related to a header issue where they suggest to do include this
%code requires{
#include <string>
}
for string case . but this also does not work for me .
The error i get is
y.tab.c:1174:9: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yylval;
^~~~~~
y.tab.c:223:7: note: ‘YYSTYPE::YYSTYPE()’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c: In function ‘int yyparse()’:
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yyvsa[YYINITDEPTH];
^
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
y.tab.c:223:7: note: ‘YYSTYPE::~YYSTYPE()’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::~basic_string() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>::~vector() [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c:1203:30: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
YYSTYPE yyvsa[YYINITDEPTH];
^
y.tab.c:1215:11: error: use of deleted function ‘YYSTYPE::YYSTYPE()’
YYSTYPE yyval;
^~~~~
y.tab.c:1215:11: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
y.tab.c:1381:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yylval;
^~~~~~
y.tab.c:223:7: note: ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’ is implicitly deleted because the default definition would be ill-formed:
union YYSTYPE
^~~~~~~
demo.y:48:12: error: union member ‘YYSTYPE::s’ with non-trivial ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
string s;
^
demo.y:49:16: error: union member ‘YYSTYPE::v’ with non-trivial ‘std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]’
vector<int>v;
^
y.tab.c:1412:24: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
yyval = yyvsp[1-yylen];
^
y.tab.c:1569:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yyval;
^~~~~
y.tab.c:1713:14: error: use of deleted function ‘YYSTYPE& YYSTYPE::operator=(const YYSTYPE&)’
*++yyvsp = yylval;
^~~~~~
y.tab.c: In function ‘void __static_initialization_and_destruction_0(int, int)’:
y.tab.c:1174:9: error: use of deleted function ‘YYSTYPE::~YYSTYPE()’
YYSTYPE yylval;
^~~~~~
I am trying to cross-compile a .go file for the GTK binding package Linux => Windows and can't figure it out. Tried going the route of setting up MSYS on Win but it was god-awful.
I looked for a Docker image but there is none.
$ ~/go/src/gui$ GOOS=windows CGO_ENABLED=1 GOARCH= CC=x86_64-w64-mingw32-gcc go build
# github.com/mattn/go-gtk/glib
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from ./glib.go.h:4,
from ../github.com/mattn/go-gtk/glib/glib.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:241:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:238:47: note: in definition of macro 'G_PASTE_ARGS'
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:241:44: note: in expansion of macro 'G_PASTE'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~
/usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~
# github.com/mattn/go-gtk/pango
In file included from /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h:9:0,
from /usr/include/glib-2.0/glib/gtypes.h:32,
from /usr/include/glib-2.0/glib/galloca.h:32,
from /usr/include/glib-2.0/glib.h:30,
from /usr/include/pango-1.0/pango/pango-coverage.h:25,
from /usr/include/pango-1.0/pango/pango-font.h:25,
from /usr/include/pango-1.0/pango/pango-attributes.h:25,
from /usr/include/pango-1.0/pango/pango.h:25,
from ./pango.go.h:7,
from ../github.com/mattn/go-gtk/pango/pango.go:5:
/usr/include/glib-2.0/glib/gtypes.h: In function '_GLIB_CHECKED_ADD_U64':
/usr/include/glib-2.0/glib/gmacros.h:241:53: error: size of array '_GStaticAssertCompileTimeAssertion_0' is negative
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^
/usr/include/glib-2.0/glib/gmacros.h:238:47: note: in definition of macro 'G_PASTE_ARGS'
#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
^~~~~~~~~~~
/usr/include/glib-2.0/glib/gmacros.h:241:44: note: in expansion of macro 'G_PASTE'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~
/usr/include/glib-2.0/glib/gtypes.h:423:3: note: in expansion of macro 'G_STATIC_ASSERT'
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));```
I'm trying to compile the latest version of opencv 3 in windows for Mingw64, using cmake-gui and I've been encountering some errors in the compiling the source files.
I have had a number of problems I've addressed so far through reading solutions for other people, but I've run into one that I can't fix. I have been unable to compile the highgui library, and if I leave it out, the compilation turns out fine.
I used the regular mingw32-make, from Mingw 64.
Here's the error log, it's pretty long and cumbersome but I hope it can provide some insight:
Scanning dependencies of target opencv_highgui
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.obj
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/roiSelector.cpp.obj
[ 83%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj
In file included from C:\opencv\sources\modules\highgui\src\window_w32.cpp:56:
C:/mingw/mingw64/x86_64-w64-mingw32/include/commctrl.h:8: error: unterminated #ifndef
#ifndef _INC_COMMCTRL
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void icvLoadWindowPos(const char*, CvRect&)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:311:46: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( szKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:311:46: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:312:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcat( szKey, 1024, name );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:312:31: error: too many arguments to function 'char* strcat(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:62:18: note: declared here
char * __cdecl strcat(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'void icvSaveWindowPos(const char*, CvRect)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:372:46: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( szKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:372:46: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:373:31: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcat( szKey, 1024, name );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:373:31: error: too many arguments to function 'char* strcat(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:62:18: note: declared here
char * __cdecl strcat(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:383:52: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( rootKey, 1024, icvWindowPosRootKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:383:52: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:402:53: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
strcpy( oldestKey, 1024, currentKey );
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:402:53: error: too many arguments to function 'char* strcpy(char*, const char*)'
In file included from C:/mingw/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/cstring:42,
from C:/opencv/sources/modules/core/include/opencv2/core/cvstd.hpp:53,
from C:/opencv/sources/modules/core/include/opencv2/core/base.hpp:58,
from C:/opencv/sources/modules/core/include/opencv2/core.hpp:54,
from C:/opencv/sources/modules/highgui/include/opencv2/highgui.hpp:46,
from C:\opencv\sources\modules\highgui\src\precomp.hpp:45,
from C:\opencv\sources\modules\highgui\src\window_w32.cpp:42:
C:/mingw/mingw64/x86_64-w64-mingw32/include/string.h:61:18: note: declared here
char * __cdecl strcpy(char * __restrict__ _Dest,const char * __restrict__ _Source);
^~~~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT HighGUIProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1629:24: warning: left operand of comma operator has no effect [-Wunused-value]
} while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1460:55: warning: this statement may fall through [-Wimplicit-fallthrough=]
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1463:5: note: here
case WM_ACTIVATE:
^~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'int cvWaitKey(int)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2075:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ('S' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
^~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2078:17: note: here
default:
^~~~~~~
mingw32-make[2]: *** [modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:91: modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1832: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
Thanks in advance for your help!
EDIT:
I reverted strcpy and strcat to strcpy_s and strcat_s because of argument issues causing the error, and went back to this:
Scanning dependencies of target opencv_highgui
[ 81%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.obj
[ 82%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/roiSelector.cpp.obj
[ 82%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj
In file included from C:\opencv\sources\modules\highgui\src\window_w32.cpp:56:
C:/mingw/mingw64/x86_64-w64-mingw32/include/commctrl.h:8: error: unterminated #ifndef
#ifndef _INC_COMMCTRL
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT HighGUIProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1629:24: warning: left operand of comma operator has no effect [-Wunused-value]
} while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'LRESULT MainWindowProc(HWND, UINT, WPARAM, LPARAM)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1460:55: warning: this statement may fall through [-Wimplicit-fallthrough=]
pos->y = mi.rcMonitor.bottom - pos->cy; // snap to bottom edge
^
C:\opencv\sources\modules\highgui\src\window_w32.cpp:1463:5: note: here
case WM_ACTIVATE:
^~~~
C:\opencv\sources\modules\highgui\src\window_w32.cpp: In function 'int cvWaitKey(int)':
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2075:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
if ('S' == message.wParam && (::GetKeyState(VK_CONTROL)>>15))
^~
C:\opencv\sources\modules\highgui\src\window_w32.cpp:2078:17: note: here
default:
^~~~~~~
mingw32-make[2]: *** [modules\highgui\CMakeFiles\opencv_highgui.dir\build.make:91: modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_w32.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1880: modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
mingw32-make: *** [Makefile:162: all] Error 2
EDIT 2: Finally fixed it, thanks for your help. The commctrl.h file needed an extra endif in the end.
I am trying to install the nmatrix gem. i have the gcc compiler installed:
C:\dev\DNA>gcc --version
gcc (GCC) 4.9.3
Copyright (C) 2015 Free Software Foundation, Inc.
then I have the following error on install:
C:\dev\DNA>gem install nmatrix
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nmatrix:
ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
using C++ standard... c++11
g++ reports version... 4.7.2
checking for rb_array_const_ptr() in ruby.h... no
checking for FIX_CONST_VALUE_PTR in ruby.h... no
checking for RARRAY_CONST_PTR in ruby.h... yes
checking for RARRAY_AREF in ruby.h... yes
creating nmatrix_config.h
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating nmatrix-i386-mingw32.def
compiling nmatrix.cpp
In file included from ./storage/storage.h:48:0,
from util/io.h:38,
from nmatrix.cpp:46:
./storage/common.h:155:3: error: 'u_int8_t' has not been declared
./storage/common.h:157:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = signed char; RDType = in
t; VALUE = long unsigned int]'
./storage/common.h:155:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = signed char; RDType = int; VALUE = long
unsigned int]' previously declared here
./storage/common.h:165:3: error: 'u_int8_t' has not been declared
./storage/common.h:167:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = float; RDType = int; VAL
UE = long unsigned int]'
./storage/common.h:165:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = float; RDType = int; VALUE = long unsign
ed int]' previously declared here
./storage/common.h:170:3: error: 'u_int8_t' has not been declared
./storage/common.h:172:3: error: redefinition of 'VALUE nm::ew_op_switch(LDType,
RDType) [with nm::ewop_t op = (nm::ewop_t)3u; LDType = double; RDType = int; VA
LUE = long unsigned int]'
./storage/common.h:170:3: error: 'VALUE nm::ew_op_switch(LDType, RDType) [with n
m::ewop_t op = (nm::ewop_t)3u; LDType = double; RDType = int; VALUE = long unsig
ned int]' previously declared here
In file included from nmatrix.cpp:283:0:
ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)':
ruby_nmatrix.c:1102:11: warning: unused variable 'elem' [-Wunused-variable]
ruby_nmatrix.c: In function 'VALUE nm_mset(int, VALUE*, VALUE)':
ruby_nmatrix.c:2013:109: warning: format '%lu' expects argument of type 'long un
signed int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'VALUE nm_xslice(int, VALUE*, void* (*)(const STORAG
E*, SLICE*), void (*)(NMATRIX*), VALUE)':
ruby_nmatrix.c:2251:92: warning: format '%lu' expects argument of type 'long uns
igned int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'SLICE* get_slice(size_t, int, VALUE*, size_t*)':
ruby_nmatrix.c:2729:106: warning: format '%lu' expects argument of type 'long un
signed int', but argument 3 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c:2729:106: warning: format '%lu' expects argument of type 'long un
signed int', but argument 4 has type 'size_t {aka unsigned int}' [-Wformat]
ruby_nmatrix.c: In function 'void* interpret_initial_value(VALUE, nm::dtype_t)':
ruby_nmatrix.c:2800:29: warning: comparison between signed and unsigned integer
expressions [-Wsign-compare]
make: *** [nmatrix.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/nmatrix-0.
2.1 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/nma
trix-0.2.1/gem_make.out
Would be really great to try out this library! Any ideas how to make the install succesful? thanks
OpenCV 2.4.6 adds support for CUDA 5.5, but attempts to build it fail. CUDA is installed from the repository for Fedora 18. OpenCV itself without the support of CUDA is also going well.
[ 1%] Building CXX object modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:52: error: 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' should have been declared inside 'cv::gpu'
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:288:6: warning: no previous declaration for 'bool cv::gpu::deviceSupports(cv::gpu::FeatureSet)' [-Wmissing-declarations]
bool cv::gpu::deviceSupports(FeatureSet feature_set)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: At global scope:
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:359:49: error: no 'size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const' member function declared in class 'cv::gpu::DeviceInfo'
size_t cv::gpu::DeviceInfo::sharedMemPerBlock() const
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:794:6: error: redefinition of 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::createContinuous(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:551:17: error: 'void cv::gpu::createContinuous(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void createContinuous(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:806:6: error: redefinition of 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)'
void cv::gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:559:17: error: 'void cv::gpu::ensureSizeIsEnough(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline void ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
^
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp: In function 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)':
/home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:831:8: error: redefinition of 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)'
GpuMat cv::gpu::allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
In file included from /home/lucky/programming/sphinx/build/3rdparty/opencv/opencv-2.4.6.1/modules/core/src/gpumat.cpp:44:0:
/home/lucky/programming/sphinx/build/output/include/opencv2/core/gpumat.hpp:567:19: error: 'cv::gpu::GpuMat cv::gpu::allocMatFromBuf(int, int, int, cv::gpu::GpuMat&)' previously defined here
inline GpuMat allocMatFromBuf(int rows, int cols, int type, GpuMat &mat)
^
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-unnamed-type-template-args" [enabled by default]
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/src/gpumat.cpp.o] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2
Is there a way to solve the problem? Or is it a problem too new version of GCC?
It seems #jet47 has elected not to respond to my request in the comments, so I'm posting this answer so that we can call this question answered (which it clearly has been in the comments.)
Make sure that you only have one installed OpenCV version, if you experience a problem like this. If you locate other installed versions besides the one intended, remove them.