You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have successfully used mxml v.2.11 in a C application under Visual Studio 2017, as per the coding guides in the documentation.
Now, I try to bring the application under Visual Studio Code/Windows 10, mxml-3, with MinGW-64 and gcc, doing the makefile myself.
I have one build error, as in this issue title, for the following function:
// Finds a node by name in a given 'tree' memory structure, then changes the value of the node's attribute with a new one
// Returns the whole memory modified tree
`mxml_node_t* changeNodeAttribute(mxml_node_t *tree, const char *nodeName, const char attrName, char newValue) {
mxml_node_t * node = NULL;
node = mxmlFindElement(tree, tree, nodeName, attrName, NULL, MXML_DESCEND);
for (int k = 0; k < node->value.element.num_attrs; k++) {
if (strcmp(node->value.element.attrs[k].name, attrName) == 0) {
node->value.element.attrs[k].value = newValue;
break;
}
}
return tree;
}`
The errors are issued by node->~ occurencies above.
I have used the right mxml1.dll, referenced its library in the makefile for the linker, also included the mxml.h file, but I'm missing something.
The exact gcc error is the following:
error: dereferencing pointer to incomplete type 'mxml_node_t' {aka 'struct _mxml_node_s'}
node->value.element.num_attrs;
Thanks
The text was updated successfully, but these errors were encountered:
Mini-XML 3.0 (which has not yet been released) requires that you access the members of the mxml_node_t structure through the accessor functions that were introduced in Mini-XML 2.0, in particular to avoid unsafe usage like your above code (which will eventually cause a crash because the value pointers need to be allocated...) The structure itself is no longer part of the public API.
The safe replacement for the code above (which also works in Mini-XML 2.x) is:
Hi,
I have successfully used mxml v.2.11 in a C application under Visual Studio 2017, as per the coding guides in the documentation.
Now, I try to bring the application under Visual Studio Code/Windows 10, mxml-3, with MinGW-64 and gcc, doing the makefile myself.
I have one build error, as in this issue title, for the following function:
// Finds a node by name in a given 'tree' memory structure, then changes the value of the node's attribute with a new one
// Returns the whole memory modified tree
`mxml_node_t* changeNodeAttribute(mxml_node_t *tree, const char *nodeName, const char attrName, char newValue) {
mxml_node_t * node = NULL;
}`
The errors are issued by
node->~
occurencies above.I have used the right mxml1.dll, referenced its library in the makefile for the linker, also included the mxml.h file, but I'm missing something.
The exact gcc error is the following:
Thanks
The text was updated successfully, but these errors were encountered: