Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.3K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 545 SQLcl
- 4K SQL Developer Data Modeler
- 187K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 440 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
Problem with C++ preprocessor

Hi, guys,
I'm working on Solaris x86 with Solaris Studio 12.6 C++ project trying to port it to build and run on Solaris.
It is successfully build on Linux with gcc, however dmake/CC has problem.
Following code:
#include "../foo/res/a.xpm"
gives an error saying "Can't open the file a.xpm"
Of course file exist in that specific location.
Is there any options to the compiler I'm missing?
In the IDE I changed to build for 64-bit and C++11.
Thank you for any suggestions.
Answers
-
Why would the compiler attempt to open a X-Pixel-Map (xpm) file? Are you attempting to build a resource shared object?
-
Hi, Billy,
Because I use it to make a bitmap and use it in this C++ file.
The line I referenced is inside a .cpp file, which is inside the .so sub-project.
Thank you.
-
Does the compiler support the XPM format used?
I assume that you did check file and directory permission.
-
Hi, Billy,
How do I check for such support?
I just followed the procedure to install Studio 12.6...
And yes - file is readable and accessible for the user.
Thank you.
-
There are a couple of formats, all text based, in two basic flavours - with C code and without C code. The 1st line indicates the format version.
Display the file (e.g. $ cat dir/x.xpm) and have a look. Make a backup of the file and replace the contents with a copy-and-paste of another format version shown as an example via googling - and try compiling again.
-
Hi, Billy,
Can I replace xpm with the embedded png?
Will this be a solution?
Thank you.
-
Unsure. Been a thousand years since I last developed in C, with Pro*C, on Unix. Well, late 90's was in the previous century... ;-)
Best is to try. And look at the actual C source reference that is used for the XPM image definition. And then look at how the docs say it works, what could be wrong in your code, and potential fixes, workarounds, and alternatives.
Look at it as an opportunity to learn more. The bigger the problem and challenge, the more one learns as a software engineer.
-
Hi, Billy,
I'm not sure what you mean by different version of XPM file.
This is the content of one of my XPMs:
[code]
/* XPM */ static const char *database[] = { /* columns rows colors chars-per-pixel */ "16 17 177 2", " c #474A45", ". c #514545", "X c #544654", "o c #534B54", "O c #595259", "+ c #5E525D", "@ c #59545E", "# c #6A6764", "$ c #66636B", "% c #74666F", "& c #7B6869", "* c #746C74", "= c #766C77", "- c #7B6874", "; c #7B6678", ": c #777278", "> c #77747C", ", c #707A7E", "< c #7F797F", "1 c #2D789C", "2 c #6F7B83", "3 c #507DAE", "4 c #817D83", "5 c #897C85", "6 c #807F8A", "7 c #897B88", "8 c #358ABE", "9 c #608297", "0 c #4C85A1", "q c #4C98BE", "w c #7499AF", "e c #7BA4B4", "r c #6FA4C8", "t c #76AFCD", "y c #878485", "u c #868585", "i c #8C8587", "p c #88848A", "a c #89878C", "s c #8D868C", "d c #8A8888", "f c #8E888A", "g c #8A888D", "h c #948888", "j c #90898C", "k c #888E93", "l c #8E8C92", "z c #948992", "x c #948E90", "c c #968A94", "v c #998E90", "b c #949294", "n c #9A9496", "m c #979399", "M c #969499", "N c #9D939A", "B c #9D9599", "V c #9C999B", "C c #A29C9E", "Z c #8497A8", "A c #9892A2", "S c #9D9BA0", "D c #859AB6", "F c #A298A1", "G c #A79AA2", "H c #A39EA1", "J c #90A3AB", "K c #8CA4B0", "L c #82ABB8", "P c #9AB3B7", "I c #9FB8BB", "U c #A4A0A1", "Y c #A6A0A6", "T c #AFA1A2", "R c #A9A4A5", "E c #A4A2A8", "W c #A9A7A9", "Q c #ABABAD", "! c #ACA9AC", "~ c #AEAAAD", "^ c #B1ADAE", "/ c #BAAEAF", "( c #ABADB7", ") c #B1ACB1", "_ c #B1AFB3", "` c #A0B0B9", "' c #A1BABB", "] c #B9B0B6", "[ c #B9B4B4", "{ c #BBB6B6", "} c #B8BAB3", "| c #B3B2B8", " . c #B5B1B8", ".. c #BAB3B9", "X. c #BEB8B8", "o. c #BFB9B8", "O. c #BCBABA", "+. c #BFB9BC", "@. c #C0B4B6", "#. c #C0B9BB", "$. c #C0B9BD", "%. c #C4BABC", "&. c #BBC4B9", "*. c #9FB8CD", "=. c #9FBCD0", "-. c #A9B9C4", ";. c #A1BACE", ":. c #BBB3C0", ">. c #BFBEC0", ",. c #BDBCC5", "<. c #C0BEC4", "1. c #A2C4CF", "2. c #B5CACF", "3. c #BDC5D2", "4. c #BDCDD2", "5. c #C5C1C1", "6. c #C6C1C0", "7. c #C4C5C3", "8. c #C6C4C6", "9. c #C8C6C5", "0. c #CAC4C7", "q. c #CBC7C7", "w. c #C7C7C9", "e. c #CEC7CC", "r. c #C2CACF", "t. c #CAC9C9", "y. c #CBC9CF", "u. c #CACACE", "i. c #CEC9CC", "p. c #CCCCCE", "a. c #D2C3C7", "s. c #D2CACD", "d. c #CFCCD3", "f. c #D6CAD1", "g. c #D0CBDD", "h. c #CCD3D4", "j. c #C1D3DD", "k. c #CCD4D9", "l. c #D4D3D7", "z. c #D8DAD7", "x. c #DAD6DD", "c. c #D5D8D8", "v. c #D9D8DC", "b. c #DDDCDC", "n. c #E0D5DC", "m. c #E1DADB", "M. c #EBDEDE", "N. c #DEE8DD", "B. c #DED7E4", "V. c #D0E3E8", "C. c #D3E0EA", "Z. c #E7E3E0", "A. c #E7E2E1", "S. c #E4E5E4", "D. c #EFE1E1", "F. c #EBE4E7", "G. c #E3E6E8", "H. c #E9E7E8", "J. c #E7E9E8", "K. c #E6E9EB", "L. c #E9E8E9", "P. c #EDE9EA", "I. c #EBEBED", "U. c #EDEDEF", "Y. c #F2E5E8", "T. c #F0EBEF", "R. c #F2EFED", "E. c #E5F6F5", "W. c #EDFCF5", "Q. c #EFF6FB", "!. c #EDFBFB", "~. c #ECFDFD", "^. c #F3F3F3", "/. c #F5F6F6", "(. c #FCF7F6", "). c #FAFAFA", "_. c #FFFFFC", /* pixels */ "_.O.b g d d u u i f h x n [ 9.R.", "R.5.O.Y d d l V U R C U U V i 9.", "A.#.0...l E ,.c.).).b.3.G 2 O p ", "Z.5.O.C 4 M .d.L.S.7.W c = @ p ", "M./ @.G 6 N [ u.H.T.f.^ v % . 4 ", "~.P ;.w 9 Z ( 7.c.k.-.D 3 1 0 ;.", "Y.f.B.g.K ` r.B.W.E.V.2.' J y %.", "M.O.{ C 5 N _ f.P.F.s.! m ; X p ", "N.&.} R 7 F ] i.L.H.q.^ c - + 5 ", "Y.^ :.A 2 k W 7.K.G.r.W h # , ", "!.' 1.L e ;.4.h.c.j.=.r 8 q t ;.", "D.a.n.0.A J ,.x./.Q.B.2.| N & T ", "A.[ +.F 2 C ..u.I.L.t.~ z * o a ", "A.] +.U g S ..l.U.I.p._ N : X 9 ", "(.m.$.s $ > M W w.w.Q l : + O v ", "_._._.).S.f.&.o.{ 3.0.p.N.^._._.", "_._._._._._._._._._._._._._._._." };
[/code]
Do you see what is wrong with it?
Thank you.
-
The XPM formats are described in web resources such as https://en.wikipedia.org/wiki/X_PixMap and https://www.fileformat.info/format/xpm/egff.htm.
Use an X11 image editor or viewer to load that XPM file and see whether it displays properly.
Or make a backup of the x.xpm file, and replace it with a basic example of an xpm image from an online resource. Compile, link, and check.
Part of what you need to do is isolate and identify the actual error. Is it really access to the file that is failing? Is it the file format used not supported? Is it another issue all together that manifests as a file access error? Etc.
I would even consider using something like strace (Linux) to trace the system calls make by the compiler for accessing the xpm file, to see if there are errors, and exactly which system calls returns an error.
-
Billy,
But that's it.
I'm getting the compiler error from dmake which looks like that it can't find the file.
Thank you.