4

OS : Ubuntu 14.04
SDK : Qt 5.5
library : "ion.h" [ I have built ion-dtn 3rd party library from source and it has ion.h file which I am using in my 2 projects ]

I am using ion.h in my 2 projects in same development system. Both projects are based on Qt. On including ion.h One project runs without any compilation error , other complains about MAXPATHLEN.

/usr/local/include/ion.h:60: error: 'MAXPATHLEN' was not declared in this scope
  char pathName[MAXPATHLEN + 1];.

On project where it's running fine , I can click on ion.h and found MAXPATHLEN is highlighted with blue, obviously means qt can find it and on clicking "follow under symbol" I found its declared in param.h under sys directory.

I cant do the same in my other project. On clicking ion.h MAXPATHLEN is in black colour and couldnt able to find param.h when I click follow under symbol.

I have compared and my .pro files are same in both projects. Can soemone please guide me what I am doing wrong. Thanks

jpo38
  • 20,821
  • 10
  • 70
  • 151
samprat
  • 2,150
  • 8
  • 39
  • 73

1 Answers1

2

MAXPATHLEN is declared in <sys/param.h>. One project must include it (or another header file including it...like <QDir> for instance, it's hard to tell) while the other does not.

Simply include <sys/param.h> before you include ion.h yourself to solve the problem.

If you really want to figure out who's including this file and then identify why MAXPATHLEN is defined in one project, there are compiler options for that (like /showIncludes for g++).

jpo38
  • 20,821
  • 10
  • 70
  • 151
  • Thanks jpo38. I have include and it solved problem. May be in project where its working fine , thsi library is already included by some other library. – samprat Dec 15 '15 at 18:18