ALL,
I finally moved away from the bitmaps and trying to use SVG in my C code.
I made an SVG using an InkScape and saved it as Compressed.
Then I edited the resulting file by adding the
static const char data[] =
in front of the XML and place every single line of XML inside double quotes.
The resulting file then is saved as .h file and included in the C source code.
However when compiling I am getting following:
error: stray ‘#’ in program
13 | " <g stroke="#000">"
| ^
What can I do? Linux does not have a notion of resources and I'd rather embed the graphics, than allow external file.
TIA!!
Below is the beginning of the header file in question:
` static const char query[] =
""
""
" "
" rdf:RDF"
" <cc:Work rdf:about="">"
" <dc:format>image/svg xml</dc:format>"
" <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>"
" <dc:title/>"
" </cc:Work>"
" </rdf:RDF>"
" "
" "
" "
" " `
CodePudding user response:
You may want raw string literal introduced in C 11.
static const char data[] = R"xxx(<?xml version="1.0"...)xxx";
This is equivalent to
static const char data[] = "<?xml version=\"1.0\"...";
CodePudding user response:
You need to format the data properly. To aid with this, please use an IDE or a good text editor such as Visual studio, Visual Studio Code or something similar. This would help you visualize the problem and fix it yourself
But to answer your question...
Use ' '
in place of " "
to break the lines up.
Example:
'<?xml version="1.0" encoding="UTF-8"?>'
in place of
"<?xml version="1.0" encoding="UTF-8"?>"