I've been trying to compile Qt on Windows and I've run into an interesting problem with #includes failing with the error that the file being included does not exist ("No such file or directory"). However the file does exist. The files doing the including are auto-generated "moc" files (made by Qt) that have an include like the following:
#include "../../../../../../../../qt-everywhere-opensource-src-4.8.2/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h"
The string in that include is 127 characters long. There are many "moc" files produced and compiled in the build, but only ones with very long lengths like this (127+ characters) fail.
The files in question happen to be sitting on a UNIX system, shared via Samba to Windows. I was able to work around the issue by creating a symlink and replacing "qt-everywhere-opensource-src-4.8.2" with "qt-4.8.2" in the affected files. The resulting include:
#include "../../../../../../../../qt-4.8.2/examples/tools/plugandpaintplugins/extrafilters/extrafiltersplugin.h"
is only 102 characters long and works just fine.
I've searched around and could not find any reference to this. Nor could I replicate the problem outside this Qt build (just making arbitrarily long file names and trying to include them). So it's possible that somehow the nmake
makefiles that Qt creates are doing something when they run cl
that causes it to reject long includes in some way.
Does anyone have any additional information on this?
What is the max string length in C#? The maximum string length in C# is 2^31 characters. That's because String. Length is a 32-bit integer.
The maximum size of the String object in memory can be 2GB or about 1 billion characters. Characteristics of String Class: The System. String class is immutable, i.e once created its state cannot be altered.
Environment String Length. There is a maximum of 32768 characters for any environment string used as a command-line argument.
Since this is used to find the included file, I tend to believe that it is connected to the OS' file path restrictions.
Maybe the implementation of the preprocessor somehow restricts it too, but that would be specific for each and every compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With