4 ms·
I just wish C had better compilers Errors produced by current mainstream compilers are terrible. "Unresolved symbol" being the best they can do is some joke
by tester756 3y ago
I just wish C had better compilers
Errors produced by current mainstream compilers are terrible.
"Unresolved symbol" being the best they can do is some joke
- jjgreen 3y agoUh? gcc (11) produces, eg /usr/bin/ld: main.o: in function `main': <path>/cptutils/src/xycpt/main.c:148: undefined reference to `xycpt' You get the file, the line, the name of the missing symbol ...
- tester756 3y agoEverything looks fine if you use hello world examples Yet when reality kicks in, then you can spend 15mins trying to figure what the hells is going on
- jjgreen 3y agoNot a hello world example, I renamed a function in a program which is part of a 13K LoC project to get that error message.
- zabzonk 3y agothat's the linker, not the c compiler
- tester756 3y agoIs this important? I treat compiler as *full* toolchain I run compilation and expect sane error messages - saying that "oh, it's because of linker yada yada" doesn't solve my problems nor is valid excuse Other language (compilers) do better.
- zabzonk 3y ago> I treat compiler as full toolchain well, you may do that, but it doesn't make it so. the linker has much less information to go on than the compiler - basically (depending on how you compiled) machine code. actually, the GNU linker does quite a good job, given what it has to work with. > Other language (compilers) do better. a language is not a compiler
- tester756 3y ago>well, you may do that, but it doesn't make it so. the linker has much less information to go on than the compiler - basically (depending on how you compiled) machine code. actually, the GNU linker does quite a good job, given what it has to work with. but it was their decision to split the tools like that, wasn't it? nothing technically prevents you to model it in such a way that you can have access to the data you need, right? You probably don't even need to have linker at all. >> Other language (compilers) do better. >a language is not a compiler I wrote compiler in parenthesis. Also, since "language" has two definitions 1. syntax 2. whole ecosystem Then it is valid either way
- zabzonk 3y agoall compiled language systems must support a separate link stage, if they are to be of any practical use
- tester756 3y agoBut all of them must have low quality error messages too?
- zabzonk 3y agoas i said, the linker only has so much information - whatever is supplied by the (possibly various) compilers and/or assemblers. which is minimal. so a linker cannot produce very accurate error messages. i'm afraid you are going to have to live with this, and understand it.
- variadix 3y agoWhat error message do you expect the linker to produce when there is a reference to a symbol that it doesn’t find in any of the object files provided?