g++ linker behavior

N

Nadina

Hello,

I have been getting the following error:

ld: fatal: file my_program: creation interrupted: No space left on
devicecollect2: ld returned 1 exit status

while I was trying to link several .o files in my project. I googled
this error and it seems to be caused by double import of external
variables/constants/functions.

However when I could not figure out what caused the error I stripped
down my program to a simple "hello world" AND... surprize I keep
getting the same error.

As long as I do
g++ my_program.c -o my_program

everything is fine. But if first build the object and then the
executable, I run into the error.

g++ -c my_program.c

g++ my_program.o -o my_program
ld: fatal: file my_program: creation interrupted: No space left on
devicecollect2: ld returned 1 exit status

Does anyone know what causes this error to occur and how can I fix it?
Thank you!
Nadina
 
V

Victor Bazarov

Nadina said:
I have been getting the following error:

ld: fatal: file my_program: creation interrupted: No space left on
devicecollect2: ld returned 1 exit status
[...]
Does anyone know what causes this error to occur and how can I fix it?

Somebody in gnu.g++.help should know. Your question is OT here since
it's not a _language_ issue, sorry.

V
 
L

Lionel B

Hello,

I have been getting the following error:

ld: fatal: file my_program: creation interrupted: No space left on
devicecollect2: ld returned 1 exit status

while I was trying to link several .o files in my project.

Note that linking is off-topic in this ng.
I googled
this error and it seems to be caused by double import of external
variables/constants/functions.

However when I could not figure out what caused the error I stripped
down my program to a simple "hello world" AND... surprize I keep
getting the same error.

As long as I do
g++ my_program.c -o my_program

everything is fine.

You're compiling a (presumably) C program [ so your post is doubly off-topic ;-) ] with a C++ compiler - might well
work, as valid C code may also be valid C++ code...
But if first build the object and then the
executable, I run into the error.

g++ -c my_program.c

g++ my_program.o -o my_program

You're trying to link a C program with a C++ linker - might well not work.
ld: fatal: file my_program: creation interrupted: No space left on
devicecollect2: ld returned 1 exit status

Does anyone know what causes this error to occur and how can I fix it?

Use gcc (not g++) for C programs.
 
H

Haro Panosyan

I remember having this error and getting puzzled long time ago.
Just tried it, and I don't see a problem any more.
I am using g++ 3.3.2.
 
N

Nadina

Haro,

Same here it comes and goes. I dont know what is causing it.
Also I noticed that I could go around it by leaving the -o option out
and then it compiles fine into the a.out file.

I posted in gnu.g++.help and no answer yet. If i hear something I'll
let you know too.
Nadina
 
H

Haro Panosyan

Thanks Nadina for update.
I guess in my case it was not the problem but
I will keep this in my mind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,147
Messages
2,570,835
Members
47,383
Latest member
EzraGiffor

Latest Threads

Top