Codeblocks can't find juce header

That would indicate an X11 linking problem. Two things to check:

Do you have all the dependencies installed?

If you look at the linking stage do you see -lX11 in the list of arguments?