User forums > Help
C/C++ parser ignores includes with minus
l_inc:
Hi everybody. I have CodeBlocks 13.12.svn.10538 on Fedora 22. <fcntl.h> includes <bits/fcntl.h>, which includes <bits/fcntl-linux.h>. Including <fcntl.h> in a cpp file does not allow to see the definitions from fcntl-linux.h unless I rename the latter into fcntl_linux.h and modify <bits/fcntl.h> accordingly.
Is that a one more bug, or am I missing something? Seems like a very common use case, and it's strange I couldn't find any related complaints on the forum.
Manolo:
Yes, very common usage. I doubt it's a bug. Showing some sample code may put some light.
Anyhow, why do you think your problem is related to C:B?
oBFusCATed:
l_inc can you provide a minimal self-contained project that can be used to reproduce the bug?
l_inc:
oBFusCATed
Sure. Here's main.cbp:
--- Code: ---<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="main" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="main" prefix_auto="1" extension_auto="1" />
<Option object_output="." />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add directory="/usr/include" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add directory="/usr/include" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion>
<search_path add="/usr/include" />
</code_completion>
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
--- End code ---
And here's main.cpp:
--- Code: ---#include <unistd.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
int fdFile = open("/dev/urandom", O_RDONLY);
close(fdFile);
return 0;
}
--- End code ---
Code completion as well as "Context Menu -> Find declaration of:" don't work on O_RDONLY. Both work OK however if I apply the modifications mentioned in the first post.
Manolo
--- Quote ---Anyhow, why do you think your problem is related to C:B?
--- End quote ---
I'm gonna try to stay serious and ask, what else you think C::B parser problems could be related to.
Manolo:
I copied & pasted your both files and tested them with C:B 13.12 (not nightly updates) in Ubuntu 14.04. Compilation and execution went smoothly. Also, O_RDONLY definition is found.
You may open a terminal and execute g++ -H main.cpp It will tell all included files. It this command fails, it's you gcc instalation, not C:B.
Navigation
[0] Message Index
[#] Next page
Go to full version