cannot find iostream in windows?
In my build system I am compiling the code with g++ so it does not report any error with complation. But once I saved the file, some yellow marks will appear on the "iostream" and "cout" etc. It shows "undeclared use of xxx", apparently either clang or easyclangcomplete cannot find the path of iostream.
1st attempt: I tried to include the folder of the iostream into the system path, did not work. 2nd attempt: I tried to add the iostream path into the .easyclangcomplete, basically I added the following path -ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include\c++
it's still not working. The yellow marks will not go away. someone got any idea? thx in advance.
Maybe try to add path to common flags in ECC config?
@T1n9 if you say you added the path to .easyclangcomplete file, then it won't work. :) The plugin does not search for such a file. It searches for .clang_complete file up the tree of your project from the current file. Anyway, the best way is to follow the suggestion of @simia - just add the needed include path to common_flags in the settings of the plugin.
@simia @niosus hi folks. thnx for the help. yes it did work. I included several folders under the c++ folder now it shows the easyclangcomplete can find iostream and cout etc.
but still something weird, the yellow mark on "cout" didnot fade away and it shows "invalid operands to binary expression xxx". So the "<<" operand is not overloaded. howcome? I thought the << operand is overloaded in the iostream file?
Maybe you are missing other includes so that you are trying to print some custom object and overloaded operator is not visible?
I feel like this is more on the code side. Can you show the code? Are you sure the value on the left is actually a stream? I will close this issue for now, but feel free to continue the discussion.
it is just a simple hello world .cpp file
#include<iostream>
int main()
{
std::cout<<"hello world"<<std::endl;
}
Can you also show which includes do you have?
so except the default folders, I have the followings:
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/backward",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/debug",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/i686-w64-mingw32",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/decimal",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/experimental",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/ext",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/parallel",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/profile",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/tr1",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/tr2",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include/c++/bits",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/include",
"-IC:/Program Files (x86)/Qt/Tools/mingw530_32/i686-w64-mingw32/lib"
This is hard. Could you provide exact error information?
so the cout is marked with yellow color when I move my cursor on it it shows: invalid operands to binary expression(ostream aka int and const char*)
as said before, I am compiling with gcc so the compilation wont be a problem but it keeps showing this msg when I save the file.
I understand. If it compiles fine on gcc then we have configuration issue. I hope so many questions doesn't discourage you. If we get to bottom of this it will be much easier to solve this kind of problems in the future.
Another question... Are you using libclang or clang binary? ("use_libclang" setting) Also are you using the same libraries for compilation as you point ECC to?
no of course not. why should I tho, I am also willing to help.
yes it's set as true. If I am using the same library I am not sure because I do not know if the g++ will call the designated lib. But I searched my C disk, that's the only place where I can find a iostream.
wait, I just turned off the use_libclang and the warnings are gone. but how come? O.o
Well I think the more important question is if plugin works:) We should aim to make it work properly with libclang turned on.
the thing is the plugin is still working, it still shows the method inside a class. But I did not test other features yet.
I think you are being affected by #88
libclang fails to find default std headers, so you have to provide it with such. While clang can find those by default. I think for now you have too many include directories there. Can you use the ones like suggested in #175 ? And remove the other ones?
I tested with this order:
-ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include -ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include\c++ -ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\bits -ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\i686-w64-mingw32 -ID:\Qt\Qt5.8.0\Tools\mingw530_32\i686-w64-mingw32\include\c++\backward
then "reference to overloaded funtion cannot be resolved, did you mean to call it?" appeared on the endl. Actually I did try this before then I thought I might need to include all the folders to avoid these yellow marks.