function call missing argument list error - c++

am trying to convert a bullet quaternion(btQuaternion) to an irrlicht quaternion(irr::core::quaternion) for a game am prototyping.
btQuaternion orientation= rigidBody->getOrientation();//now turn bullet quaternion -> irrlicht
finalOrientation= core::quaternion(orientation.getX, orientation.getY, orientation.getZ, orientation.getW);
However am getting an error i cant figure out.
Error 1 error C3867: 'btQuadWord::getX': function call missing argument list; use '&btQuadWord::getX' to create a pointer to member c:\users\matia\documents\visual studio 2008\projects\bulletimplant\bulletimplant\bulletimplant.cpp 86
Error 2 error C3867: 'btQuadWord::getY': function call missing argument list; use '&btQuadWord::getY' to create a pointer to member c:\users\matia\documents\visual studio 2008\projects\bulletimplant\bulletimplant\bulletimplant.cpp 86
Error 3 error C3867: 'btQuadWord::getZ': function call missing argument list; use '&btQuadWord::getZ' to create a pointer to member c:\users\matia\documents\visual studio 2008\projects\bulletimplant\bulletimplant\bulletimplant.cpp 86
Error 4 error C3867: 'btQuaternion::getW': function call missing argument list; use '&btQuaternion::getW' to create a pointer to member c:\users\matia\documents\visual studio 2008\projects\bulletimplant\bulletimplant\bulletimplant.cpp 86
visual studio is complaining about a function call missing an argument list but i cant find a solution. Please help. Thanks

Assuming none of the functions expect any argument, I believe you need :
finalOrientation= core::quaternion(orientation.getX(), orientation.getY(), orientation.getZ(), orientation.getW());
The compiler complains because getX, getY, getZ and getW are functions, and functions should be followed by an argument list when invoked.

Related

Compile error when using QUERY like in documentaion described

I'm following the documentation and got an error during compilation following example:
https://oatpp.io/docs/components/api-controller/#query-parameters-mapping
Visual Studio 2017 is complaining about C2839:invalid return type 'type' for overloaded 'operator ->' and C2232 '->' : left operand has 'class-key' type, use '.' when I try to use age like mentioned in the example.
ENDPOINT("GET", "/users", getUsers,
QUERY(Int32, age))
{
OATPP_LOGD("Test", "age=%d", age->getValue());
return createResponse(Status::CODE_200, "OK");
}
What's wrong with the usage/example?
Documentation is outdated, solution is:
OATPP_LOGD("Test", "age=%d", *age);

c++ compile error C4430, C2653, C2146, C2143

I am working on some simulation software, written in C++. Currently, when trying to build my code, I get 9 compile errors, all complaining about the three lines of code that I've just added. Those lines are the declarations in PublisherModule.h:
class PublisherModule :
public s::Module,
public s::Singleton<PublisherModule>,
public s::Interface,
public s::htmlPage{
public:
...
Types::ModeRecord;
ModeRecord modeData;
ModeRecord *modeDataPtr;
...
};
The reason for adding these declarations into the PublisherModule.h was so that I could add the following code into the publish() function of the PublisherModule.cpp file:
Types::ModeRecord ModeData;
Types::ModeStatusRecord *ModeDataPtr = &ModeData;
DataStore->getModeData(*ModeDataPtr);
The publish() function now looks like this:
void PublisherModule::publishData(void){
...
Types::ModeRecord ModeData;
Types::ModeStatusRecord *ModeDataPtr = &ModeData;
DataStore->getModeData(*ModeDataPtr);
...
}
The errors that the compiler is giving me are:
error C2653: 'Types': is not a class or namespace name
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
error C2146: syntax error : missing ';' before identifier 'ModeData'
error C2143: syntax error : missing ';' before '*'
I get error C4430 4 times in total, and the other errors all once each. They are all complaining about the lines that I added into the .h file. Having Google'd the first error, and come across this answer on SO: Compiler error C2653: not a class or namespace name , it would appear that the cause is a circular dependency in the header files...
But that is not happening here as far as I can tell... Are there any other reasons why I might get this compile error, and what's preventing my code from building?
The message displayed when I hover my cursor over the first line that I've added in the .h file, Types::ModeRecord is:
Error: a class-qualified name is required
Here is an abbreviated version of the code you posted, with my observation:
class PublisherModule [... bunch of base classes...]
{
public:
Types::ModeRecord;
};
What do you think this line does??
Types::ModeRecord;
It is not of the form [TypeName] [VariableName]; (eg int i;)
It does not look like a method prototype (eg void foo(int i);)
It is not a typedef.
It doesn't look like any normal C++.
What do you think it is doing?

Fatal error: Call to a member function link()

i am receiving an error while editing extensions in opencart.
Fatal error: Call to a member function link() on a non-object in C:\xampp\htdocs\organics2you\admin\controller\module\couponpop.php on line 28
this problem because the different version just creat variable and pass object of url as $data['url']=$this->url; and call it from your temp;

Error on Visual C++ Forms, Simple MessageBox and assign text from textfield to string

private: System::Void btn_entrar_Click(System::Object^ sender, System::EventArgs^ e) {
string btn_texto = txt_login->Text->ToString();
MessageBox(NULL, "Hello!", btn_texto.c_str(), MB_OK | MB_ICONEXCLAMATION);
}
I'm creating a windows forms application normally in Visual C++ Studio 2008 Professional, I added a click function (by double clicking in the button on the design mode) so I wrote the code inside the function it generated.
it generated 2 errors:
Error 1:
error C2440: 'initializing' : cannot convert from 'System::String ^'
to 'std::basic_string<_Elem,_Traits,_Ax>'
Error 2:
error C2872: 'MessageBox' : ambiguous symbol 1> could be
'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winuser.h(7374)
: int MessageBox(HWND,LPCTSTR,LPCTSTR,UINT)' 1> or
'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll
: System::Windows::Forms::MessageBox'
I'm creating in C++ on Visual Studio 2008 Professional at Windows 7 and the project under .NET Framework 3.5
Someone know how do I fix this? I looked it up all over but couldn't find a solution.
I hope I gave enough information.
Thanks in advance.
#edit Example Given by Cody Gray
System::String btn_texto = txt_login->Text->ToString();
System::Windows::Forms::MessageBox(NULL, "Hello!", "HI", MB_OK | MB_ICONEXCLAMATION);
Errors Gotten
error C3149: 'System::String' : cannot use this type here without a
top-level '^' error C2661:
'System::Windows::Forms::MessageBox::MessageBox' : no overloaded
function takes 4 arguments
So I solved the first error by adding ^ after System::String
being like this:
System::String^ btn_texto = txt_login->Text->ToString();
but the second error wasn't fixed, and by the way, how would I add the "btn_texto" content in the MessageBox Function? Thanks!
System::String^ btn_texto = txt_login->Text->ToString();
MessageBox::Show( "Working", "Info", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
Solved it. :)
You're mixing C++ string types (std::string) and .NET Framework string types (System::String) all over the place, and that's just not going to work out well. Or at least it's not going to be very simple. Decide which one you want to use and stick with it.
More specifically, the first error is caused by this line being wrong:
string btn_texto = txt_login->Text->ToString();
The first reason it's wrong is because it creates an object of type std::string (presumably, you have a using namespace std; statement at the top of your code file), which is the C++ string type, not the .NET Framework string type. The .NET Framework string type is the one that you'll probably want to use in a .NET WinForms application. You'll have to fully qualify the namespace as System::String.
The second reason it's wrong is because it's pointless to convert a String object (as returned by the Text property) to a String object using the ToString() method. Leave that last function call off completely.
The second error is caused by the fact that the Win32 headers provide a MessageBox function, as does the .NET Framework. The compiler needs to know which one you want to call.
To call the Win32 MessageBox function (like you're attempting to do now), you need to use the global scope resolution operator: ::MessageBox.
But then you're going to run into the problem of not being able to convert from System::String into a C-style string. See this article for instructions on how to convert between the various string types available in C++/CLI.
The simpler approach is probably to call the .NET version of the MessageBox function, which you can accomplish by fully qualifying like so: System::Windows::Forms::MessageBox. The advantage of this version is that you won't need to do any string conversion because it accepts a parameter of type System::String. The .NET MessageBox wrapper supports all the same options as the Win32 MessageBox function, but some of them are in a different order, so you'll need to pay careful attention to the documentation.

C++ Does Not Name A Type

I get confused when I get errors like these
I have
FxSmartPtr<FxStreamable> able(FcNew,stream->StreamInObject());
FxGlobalPair pair(id,able);
I get an error on FxGlobalPair pair(id,able); that is able is not a type.
I tried modifying to
FxGlobalPair pair(id,FxSmartPtr<FxStreamable>::able);
but I get an error that is error: 'class FxSmartPtr<FxStreamable>::able' has not been declared
What concept am I missing?
UPDATE: typedef pair<FxID, FxSmartPtr<FxStreamable> > FxGlobalPair;
UPDATE 2:
Heading
I think that you have found the Most Vexing parse
The problem is that
FxSmartPtr able(FcNew,stream->StreamInObject());
may define a function named able, instead of a variable.