PDA

View Full Version : Qt Creator Creator does not use CPATH/C_INCLUDE_PATH for code parsing



AlexTiger
30th November 2016, 13:51
Hello!

I'm using QtCreator as code editor. I added the following new env variables to project settings:


CPATH = /home/alex/Сервер/Dropbox/Projects/Smilodon2/bin/
C_INCLUDE_PATH = /home/alex/Сервер/Dropbox/Projects/Smilodon2/bin/
LD_LIBRARY_PATH = /home/alex/Сервер/Dropbox/Projects/Smilodon2/bin/

Everything compiles and works well. But the QtCreator isn't able to find my header files and highlights "unknown" types as errors:

12234

This file exists (the compiler also can see it):

alex@laptop:~$ ls -l /home/alex/Сервер/Dropbox/Projects/Smilodon2/bin/
итого 50
drwxrwx--- 1 alex alex 4096 нояб. 30 16:37 libsmilo
-rwxrwx--- 1 alex alex 10493 нояб. 30 16:37 libsmilo.h
lrwxrwxrwx 1 alex alex 50 нояб. 30 16:37 libsmilo.so -> libsmilo.so.0.15.9368
lrwxrwxrwx 1 alex alex 50 нояб. 30 16:37 libsmilo.so.0 -> libsmilo.so.0.15.9368
lrwxrwxrwx 1 alex alex 50 нояб. 30 16:37 libsmilo.so.0.15 -> libsmilo.so.0.15.9368
-rwxrwx--- 1 alex alex 31385 нояб. 30 16:37 libsmilo.so.0.15.9368
drwxrwx--- 1 alex alex 0 нояб. 30 16:37 tests


How can I ask QtCreator to follow CPATH/C_INCLUDE_PATH correctly? I *need* to use <..> brackets as my project will be installed as library. But for tests I need to deploy it locally.


UPDATED:
I have found that I can make it to see includes right if I start it with CPATH set variable:

alex@laptop:~$ CPATH=/home/alex/Сервер/Dropbox/Projects/Smilodon2/bin /opt/Qt/Tools/QtCreator/bin/qtcreator

So, looks like the problem is that the creator ignores CPATH in project settings when parsing the code.

hunger
1st December 2016, 06:12
What makes you think that creator should use random environment variables to feed it's code model?

Just use a supported build system and set that up to use the proper include paths and creator will use those settings. Or if you have to use a generic project, put the include paths into the expected file.