void CityXMLManager::print_patch_to_xml (
patch_type _type,
vector <patch_type> & _neighbours_types,
vector <pair<Vector3, float > > & _obstacles)
Hi,
I would like to ask if the lines above are accepted in terms of syntax? This line of code worked fine previously in Window and Visual Studio 2008 compilation. Then the errors come when the same code is threw into the mac os x environment. Some one passed down these codes to me and I do not understand what is happening in this line.
The errors complained are:
Use of undeclared identifier 'patch_type'
Variable has incomplete type 'void'
'_neighbours_types' was not declared in this scope
'_patch_types' was not declared in this scope
Reference to 'vector' is ambiguous
Thanks in advance!
Related
hmm...
I imported:System.math...
test as integer=sgn(100)
I get the error: sgn is not declared.
Other math functions work.
So Why?
Might Visual Studio not be correctly installed?
Thank Yall!
flabbergasted: Jhonny Q
Missing the character "i"
That particular Math function is named sign.
Thus sgn, being user defined, misses its declaration.
Thanks for you response; Sep Roland.
That alone still gets me a: is not declared.
What works is: Math.Sign. ,or do a: Imports System.Math.
Then sign works also.
I have some simple C++ code which won't be compiled by the Clang based C++11 compiler bccaarm of C++ Builder 10.1 Berlin.
This is the code:
TComponent* Comp = new TComponent(this);
std::vector<TComponent*> Comps;
Comps.push_back(Comp);
And this is the error:
[bccaarm error] stl_iterator.h(963): rvalue reference to type
'value_type' (aka 'System: classes::TComponent * __strong') can not be
bound to lvalue of type '__borland_class * isTObj __strong' (aka
'System::Classes::TComponent * __strong')
The compiler stops at line 963 in the file stl_iterator.h:
The other C++ compilers bcc32 and bcc32c(also Clang based) have no problems with this code.
When Compis not from type TComponent or another descendant from TObject the code compiles without any problem.
I have no idea what is wrong with this code and why there is a problem with R and L values...
Does anybody know what to do here?
To get the above code compiled the vector type has to be defined as an unsafe pointer.
TComponent* Comp = new TComponent(this);
std::vector<__unsafe TComponent*> Comps;
Comps.push_back(Comp);
I openened a support case for an other problem I had. The embarcadero support gave me the following information which I applied to this problem and it seems to work:
__unsafe tells the compiler that object lifetimes will be handled and no ARC code is generated for the objects
More about this topic:
http://docwiki.embarcadero.com/RADStudio/Berlin/en/Automatic_Reference_Counting_in_C%2B%2B#weak_and_unsafe_pointers
I know there are plenty of questions asking about how to solve "Null passed to a callee that requires a non-null argument", but I really can't seem to find a solution for my problem.
I use a function called PasteboardPutItemFlavor in my code. It compiles alright if I set the deploy target to 10.12 built against macSDK10.12. After I set the deploy target to 10.8, but still compile it against macSDK10.12, I got an error on PasteboardPutItemFlavor call. The error message is "Null passed to a callee that requires a non-null argument". What does this error mean? kPasteboardFlavorNoFlags is defined as 0, changing to other constant value doesn't change anything.
How do I solve this error with 10.8 as deploy target and compile against 10.12?
PasteboardPutItemFlavor(
m_pboard,
nullptr,
flavorType,
dataRef,
kPasteboardFlavorNoFlags);
The function declaration is
OSStatus PasteboardPutItemFlavor(PasteboardRef inPasteboard, PasteboardItemID inItem, CFStringRef inFlavorType, CFDataRef inData, PasteboardFlavorFlags inFlags);
I looked into the header file from 10.12 SDK. The header file is warped with nonnull macro. So any pointer with that macro would be declared as nonnull. In my case is the nullptr parameter. I simply create a local variable and set to 0 then pass it in PasteboardPutItemFlavor. That solves the error.
Can I call a block from the XCode debugger? I just tried:
po zoomCurve(0)
Which has the type:
typedef CGFloat (^STAnimationCurveBlock)(CGFloat t);
And the debugger says:
error: called object type 'STAnimationCurveBlock' (aka '__block_literal_generic *') is not a function or function pointer
error: 1 errors parsing expression
As described in this answer, the debugger doesn't seem to know the type of the block. You need to cast the block to its type. In the specific case you have there:
po ((CGFloat(^)(CGFloat))zoomCurve)(0.9)
For some reason, casting to the typdef type also doesn't work, and gives the same error. Specifically, this will give the same error:
po ((STAnimationCurveBlock)zoomCurve)(0.9)
I have a class non-static member function, and it has variable arguments, I'm compiling on Visual Studio 2005, with the 64-bit runtime, on 64-bit Windows.
void Class::Foo(void* ptr,...)
{
va_list args;
va_start(args,ptr);
float f=va_arg(args,float);
va_end(args)
}
I'm expecting a float, I pass a float to the function. But when I debug - I don't get the float I've passed. In fact - it's being received by the function as a 64-bit double! I have to do this:
double d=va_arg(args,double);
float f=(float)d;
Now I know Win64 likes to pass parameters in registers, and casts floats when it does this, shouldn't a va_list always be on the stack?
According to most references, I should have just a clean stack full of the passed parameters.
My question is: is this correct behaviour, or a bug? And if it's a bug, is it my bug, or Microsoft's?
I have the defines WIN64 and _M_AMD64, and WIN32 is undefined.
I don't have the C++ standard here, but it follows the C standard in this matter. C99, 6.5.2.2p7 says
If the expression that denotes the
called function has a type that does
include a prototype, the arguments are
implicitly converted, as if by
assignment, to the types of the
corresponding parameters, taking the
type of each parameter to be the
unqualified version of its declared
type. The ellipsis notation in a
function prototype declarator causes
argument type conversion to stop after
the last declared parameter. The
default argument promotions are
performed on trailing arguments.
So for your float argument, "default argument promotions" are performed.
These are defined in p6 as
If the expression that denotes the
called function has a type that does
not include a prototype, the integer
promotions are performed on each
argument, and arguments that have type
float are promoted to double. These
are called the default argument
promotions. [...]
So all floats are converted to double when being passed to an ellipse. VS apparently conforms in this respect, and the bug is in your code, which shouldn't use float in va_arg.
Looks like it is a VC++ x64 bug.
FIX: The va_arg function returns an incorrect value in a Visual C++ 2005 application