You are not logged in.
Pages: 1
I'm getting a very wired behaviour of the latest gcc from pacman. It's too wired that I could demonstrate it with a simple example:
[tjm@ArchPad tmp]$ tee poc.cc <<<'#include <iostream>'
#include <iostream>
[tjm@ArchPad tmp]$ gcc ./poc.cc
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../lib/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: /tmp/ccqFo8tS.o: in function `__static_initialization_and_destruction_0(int, int)':
poc.cc:(.text+0x25): undefined reference to `std::ios_base::Init::Init()'
/usr/bin/ld: poc.cc:(.text+0x3a): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
[tjm@ArchPad tmp]$ I have tried reinstall gcc and binutils. However, it didn't help. Anyone have any ideas on how to fix this?
Last edited by TJM (2020-11-26 14:55:33)
Offline
By adding a main function?
Offline
By adding a main function?
That doesn't help either.
[tjm@ArchPad tmp]$ cat poc.cc
#include <iostream>
int main() {
return 0;
}
[tjm@ArchPad tmp]$ gcc ./poc.cc
/usr/bin/ld: /tmp/ccoDqwYo.o: in function `__static_initialization_and_destruction_0(int, int)':
poc.cc:(.text+0x30): undefined reference to `std::ios_base::Init::Init()'
/usr/bin/ld: poc.cc:(.text+0x45): undefined reference to `std::ios_base::Init::~Init()'
collect2: error: ld returned 1 exit status
[tjm@ArchPad tmp]$ Last edited by TJM (2020-11-26 14:48:51)
Offline
I can confirm the output if I try - as you are doing - to compile c++ code with a c compiler. That's not very surprising. Use g++ for that.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I can confirm the output if I try - as you are doing - to compile c++ code with a c compiler. That's not very surprising. Use g++ for that.
Ahh, that helps. Thanks.
Offline
Please use [SOLVED] rather than [CLOSED] to denote solved threads
Offline
Pages: 1