I have using the CCNumber repo found here in my Cocos2D-X application. The code
inline int compare(const CCNumber<_typeT>* rhs)
{
return memcmp((void*)&m_type, (void*)&rhs->m_type, sizeof(_typeT));
}
gives me an error
Invalid arguments '
Candidates are:
int memcmp(const void *, const void *, ?)
what am i doing wrong ?
Try following steps:
Clean
Refresh
Rebuild project indexes
Edit:
If this doesn't fix the problem. Try disabling Code Analysis as mentioned here
Related
the following code snippet worked in Visual Studio 2005 (with boost 1.34) but it fails to compile in Visual Studio 2015 (with boost 1.62) saying that "error C2672: 'boost::bind': no matching overloaded function found"
Am I missing something here?
Thank you!
typedef boost::shared_ptr< int > SProxySharedPtr;
SProxySharedPtr m_sptr_proxy;
auto a = boost::bind(&SProxySharedPtr::reset, &m_sptr_proxy);
boost::shared_ptr<.>::reset() is an overloaded member function. As a consequence, you have to designate explicitly which overload you want to use:
auto a = boost::bind(static_cast<void(SProxySharedPtr::*)()>(&SProxySharedPtr::reset), &m_sptr_proxy);
I tried to use GCC but saw similar errors. The only way I can get it compile is to subclass boost::shared_ptr as below (but maybe this is not what you are asking for):
typedef boost::shared_ptr<int> SProxySharedPtr;
struct Bar : SProxySharedPtr {
void reset() {
SProxySharedPtr::reset();
}
};
int main()
{
const Bar m_sptr_proxy;
boost::bind(&Bar::reset, &m_sptr_proxy);
}
I'm on first time building a project using wxWidget in Visual Studio, all config for project follow as this : https://wiki.wxwidgets.org/Microsoft_Visual_C%2B%2B_Guide
But now I have a problem when try to build this, in file any.h (from wxWidgets 3.1 include ), this error was appeared:
Error 1 error C2665: 'operator new' : none of the 4 overloads could
convert all the argument types
At block:
class wxAnyValueTypeOpsInplace
{
public:
static void DeleteValue(wxAnyValueBuffer& buf)
{
GetValue(buf).~T();
}
static void SetValue(const T& value,
wxAnyValueBuffer& buf)
{
// Use placement new
void* const place = buf.m_buffer;
::new(place) T(value); ***//Error here***
}
static const T& GetValue(const wxAnyValueBuffer& buf)
{
// Use a union to avoid undefined behaviour (and gcc -Wstrict-alias
// warnings about it) which would occur if we just casted a wxByte
// pointer to a T one.
union
{
const T* ptr;
const wxByte *buf;
} u;
u.buf = buf.m_buffer;
return *u.ptr;
}
};
I've searched for several hours but cant see anything relate to this, please help me.
More info : I'm adding wxWidgets by using NuGet, and link by static library.
This is full error message.
I didn't edit anything in wxWidgets since it has been downloaded, and i'm using Visual Studio Express 2013 for Windows Desktop.
I am trying to install openCV 2.4.2 on Windows x64 and Netbeans. I have followed the following guide: http://projectsfromhellandmore.blogspot.co.nz/2012/06/opencv-241-netbeans-windows-7-plus.html
When I try to compile the sample code included in the guide I get the following errors for the following blocks of code in the file "include/opencv2/core/operations.hpp" and I have not found any fixes or figured out how to fix it myself:
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
error: got 2 template parameters but 1 required
And the second block of code with an error is:
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
error: redefinition of ...(the function in the first block of code)
Any help would be greatly appreciated thanks
I faced the same problem with MinGW with opencv2.4.x and later on found out that there was nothing wrong with the operations.hpp file. Instead, the MinGW compiler that i had installed was at fault. I reinstalled the compiler from sourcefourge and it worked. Check your netbeans compiler.
I faced the same problem. the solution to this problem is just comment out the entire template inline function. this function is declared twice just below one another thats why the issue. just comment out one of them.
I'm still new to boost::bind, and now porting a program that was written 2 yrs ago in 2009, seeing the compile error below. Any idea to workaround would be appreciated.
Extracted cpp file:
class ClassA {
private:
cNamespace::Bounds bounds_msg_;
void boundsHandler(const PublisherPtr& p) {
p->publish(bounds_msg_);
}
void funcA() {
node_->advertise<cNamespace::Bounds>("bounds", 10,
boost::bind(&ClassA::boundsHandler, this, _1)); // <---- Line 445
}
};
Error upon CMake:
/home/userA/ClassA.cpp:445: instantiated from here
/usr/include/boost/bind/bind.hpp:313: error: no match for call to ‘(boost::_mfi::mf1<void, ClassA, const PublisherPtr&>) (ClassA*&, const ros::SingleSubscriberPublisher&)’
Environment: Ubuntu 10.10, g++ (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5
Might not be necessary but API reference of function advertise is here, or:
template<class M >
Publisher advertise (const std::string &topic,
uint32_t queue_size,
const SubscriberStatusCallback &connect_cb,
const SubscriberStatusCallback &disconnect_cb=SubscriberStatusCallback(),
const VoidConstPtr &tracked_object=VoidConstPtr(),
bool latch=false)
It looks like the function object that is produced by boost::bind is called with a different type than the function you bound.
i.e. it's called with const ros::SingleSubscriberPublisher& argument, instead of the expected const PublisherPtr& p.
Assuming SubscriberStatusCallback is a boost::function, you should make sure its argument matches the one you bound.
I'm currently on vacation far away from my desktop, however I wanted to practice my c++ in particular with openCV, so I brought my laptop along. Given time and family constraints I didn't get everything set up in time with the libraries before flying.
I've set everything up with regards to VS 2010 as I recall doing on my desktop a while ago, but on compiling the test example on the openCV website (http://opencv.willowgarage.com/wiki/VisualC%2B%2B) I receive the following errors:
Error 3 error C2244: 'cv::Matx<_Tp,,>::diag' : unable to match function definition to an existing declaration C:\Program Files\OpenCV2.2\include\opencv2\core\operations.hpp 372
Error 4 error C2244: 'cv::Matx<_Tp,,>::diag' : unable to match function definition to an existing declaration C:\Program Files\OpenCV2.2\include\opencv2\core\operations.hpp 448
which in turn shows me:
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const Matx<_Tp,MIN(m,n),1>& d)
{
Matx<_Tp,m,n> M;
for(int i = 0; i < MIN(m,n); i++)
M(i,i) = d[i];
return M;
}
template<typename _Tp, int m, int n> inline
Matx<_Tp, MIN(m,n), 1> Matx<_Tp, m, n>::diag() const
{
diag_type d;
for( int i = 0; i < MIN(m, n); i++ )
d.val[i] = val[i*n + i];
return d;
}
I've looked into this error on the msdn and have looked on the openCV forums, but I couldn't find record of this specific error and I'm not sure how to resolve it.
Is it also problematic that I'm running the 64 bit version of Windows 7? I read that openCV2.2 is compatible however previously while the programs would compile, it kept on saying the .dll files were missing even though the PATH variable and directories were correct.
Thanks,
Jean-Pierre
I had the same issue running Opencv2.2 on 32bit Win7 VS2010 and QT 4.7.2.
I doesn't seem to be an error that affects the actual function of code. When I turned code analysis off as Himanshu jain described above it fixed the problem.
It seems indeed that the option advanced compiler option "/analyze" causes this problem (I'm using OpenCV 2.2 with VS 2008 on Win XP 32bit). I could fix the first error:
In line 365, you got to replace Matx<_Tp,MIN(m,n),1> with diag_type, i.e. this
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const Matx<_Tp,MIN(m,n),1>& d)
becomes
template<typename _Tp, int m, int n> inline
Matx<_Tp,m,n> Matx<_Tp,m,n>::diag(const diag_type& d)
Unfortunately, the 2nd error still occurs -- I found no way to get rid of it but to deactivate \analyze :-(
1>D:\OpenCV2.2\include\opencv2/core/operations.hpp(447) : error C2244: 'cv::Matx<_Tp,,>::diag':
unable to match function definition to an existing declaration
If you find a way to fix this, please let me know -- I think I'll go ahead and post a bug-report-ticket on OpenCV Trac now...