GCC link error help!

LIU Hao lh_mouse@126.com
Mon Oct 11 06:43:25 GMT 2021


在 10/11/21 1:10 PM, Tom Kacvinsky via Gcc-help 写道:
>>
>>   It seems that the link can not fond some lib, but the real reason is that
>> the project path and source code file on windows environment is too long.
>> But,if we use the same GCC version to compile my project on Linux
>> enviroment, it can compile sucess. The GCC compiler and source code we used
>> on Linux is same with Windos.
>>   We don't know how the GCC restict the path lenth and source code file

The conventional DOS path has a hard limit of 259 characters: 3 for the drive letter and immediate 
colon-slash, and 256 for the path itself. (If the null terminator is counted then it's 260 
characters, which is exactly the value of `PATH_MAX`.)

The simple solution is to move the toolchain to somewhere shallower, apparently.

The permanent solution to this problem would be using UNC paths. For example, instead of writing 
`C:\Windows`, you write `\\?\C:\Windows`. This makes use of a 64KiB buffer, but please note Windows 
NT uses UTF-16 paths, so the length limit of a path is 32767 UTF-16 code units.


-- 
Best regards,
LIU Hao

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20211011/fb825896/attachment.sig>


More information about the Gcc-help mailing list