d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Building A Programm, Include Errors
Add Reply New Topic New Poll
Member
Posts: 21,362
Joined: Sep 16 2009
Gold: 13.13
Sep 25 2013 01:01am
im building a programm with ./waf build and it complies like 100 .cc programs

on 2 programs i get error usually missing libxml files, ill give you the code, just changed the names of the files.

all the xml files are located in my usr/include/libxml2/libxml

file1.h:

Code
#include <string>
#include <string>
#include <libxml/xmlwriter.h>
#include <libxml/xmlreader.h>



file1.cc:

Code
#include "file2.h"
#include <libxml2/libxml/encoding.h>
#include <libxml2/libxml/xmlwriter.h>


file2.h:

no includes referring to libxml

file2.cc:

Code
#include <libxml/encoding.h>
#include <libxml/xmlreader.h>
#include <libxml/xpath.h>



i used many includes for some tests, but always got different errors:

Code
//#include <libxml2/libxml/xmlreader.h>
//#include <libxml2/libxml/xmlversion.h>
//#include <libxml/xmlexports.h>
//#include <libxml2/libxml/encoding.h>
//#include <libxml2/libxml/xmlwriter.h>
//#include "libxml2/libxml/parser.h"



if i use the originally files, the first error i get is:

In file included from ../src/x/file1.cc:7:0:
../src/x/file1.h:12:30: fatal error: libxml/xmlwriter.h: No such file or directory
compilation terminated.

this error refers to #include <libxml/xmlwriter.h> in file1.h i guess, so where is the problem?

trying to add -I/usr/include/libxml2 to my compiler, it says: no such file or directory

This post was edited by Br0 on Sep 25 2013 01:08am
Member
Posts: 21,362
Joined: Sep 16 2009
Gold: 13.13
Sep 25 2013 01:57am
Another Error:

In file included from ../src/x/file1.cc:7:0:
../src/x/file2.h:12:30: fatal error: libxml/xmlwriter.h: No such file or directory
compilation terminated.

this refers to #include "file1.h" in file1.cc and to #include <libxml/xmlwriter.h> in file1.h

btw, i made a mistake in the first post:

file1.cc:

Code
#include "file1.h"
#include <libxml2/libxml/encoding.h>
#include <libxml2/libxml/xmlwriter.h>


thats right

it might work when i use this command:

g++ file1.cc -I/usr/include/libxml2 -lxml2 -o output

but this results in another error: file1.cc:8:21: fatal error: ns3/log.h: No such file or directory

there is a google grp related to the same problem, but i dont really understand the given solution:

https://groups.google.com/forum/#!msg/ns-3-users/5TSImRw8kiM/FdefcE01ku4J

dont really know how to add the 'stats' and 'config-store', because those are folder and not .h's. (im not even sure, where to add the includes, but i think in file1.cc or file1.h in this case.)

This post was edited by Br0 on Sep 25 2013 02:15am
Member
Posts: 237
Joined: Aug 6 2011
Gold: 6,026.00
Sep 25 2013 08:21am
I'm not a gcc user but essentially with any compiler you have to tell it where to find the extra dependencies it needs, and if those are in a folder it does have in its list of additional search folders, you have to give the compiler that address. This isn't done in the source, it's done either in the project management or at compile time in the command line invoking the compiler.
Member
Posts: 16,144
Joined: Mar 27 2008
Gold: 14,618.00
Sep 25 2013 01:10pm
here you can read that /usr/include is automatically searched for the h files: http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

are you sure you got the h files in there?
Code
sudo updatedb
locate xmlwriter.h


i don't understand 100% what you tried, but tell us which OS you use and pm me name of tool to compile (the one in google group mentioned?)
Member
Posts: 21,362
Joined: Sep 16 2009
Gold: 13.13
Sep 25 2013 01:16pm
i used "./waf build" in order to compile

the problem wasn't compiler or libxml related, it was a specific issue which was solved by changing the sourcecode

the includes and everything else was right

This post was edited by Br0 on Sep 25 2013 01:16pm
Member
Posts: 17,856
Joined: Apr 4 2012
Gold: 59.31
Sep 29 2013 07:46pm
brains correct these kind of errors all time !!!!!! yay for brains!!!
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll