Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    [c & gas]Problemi linker

    Ciao!!!


    Ho scritto un programma un po in assebler e un po in c, quando pero a fare il link tra i vari file oggetto, il linker mi ritorna come errore tutte le chiamate che faccio alla liberie nelle funzioni c, giustamente mi segnala questo errore :

    codice:
    getch.o: In function `getch_eco':
    getch.c: (.text+0x18): undefined reference to `tcgetattr'
    getch.c: (.text+0x2d): undefined reference to `perror'
    getch.c: (.text+0xb9): undefined reference to `tcsetattr'
    getch.c: (.text+0xce): undefined reference to `perror'
    getch.c: (.text+0xde): undefined reference to `getchar'
    getch.c: (.text+0xfc): undefined reference to `tcsetattr'
    getch.c: (.text+0x111): undefined reference to `perror'
    getch.o: In function `getch':
    getch.c: (.text+0x149): undefined reference to `tcgetattr'
    getch.c: (.text+0x15e): undefined reference to `perror'
    getch.c: (.text+0x1ea): undefined reference to `tcsetattr'
    getch.c: (.text+0x1ff): undefined reference to `perror'
    getch.c: (.text+0x20f): undefined reference to `getchar'
    getch.c: (.text+0x22d): undefined reference to `tcsetattr'
    getch.c: (.text+0x242): undefined reference to `perror'
    Io ho incluso le librerie : unistd , errno , termios!!!

    Non sono riuscito a trovare il corrispondente file oggetto di queste librerie....
    Mi sapete aiutare???

    Ho provato anche ad linkare con : libglib.so, pero non funzionava lo stesso ( però il linker non dava errori), forse centra che questa è una libreria dinamica??

  2. #2

  3. #3
    Niente!!

    Ho dato come comando :
    codice:
    ld -lc crt0.o getch.o prova.o /usr/lib/libglib-2.0.so -o prova.out
    provo a lanciare con : ./prova.out e mi dice il file non è presente quando c'è!!!

  4. #4
    Prova semplicemente:
    codice:
    ld crt0.o getch.o prova.o -lc -o prova.out

  5. #5
    Cosi errori non ne da... Ma sucede una cosa che non capisco, do il comando : ./prova.out e mi dice che non c'è il file, quando è stato appena creato!!!! Assurdo... Non capisco il perchè....

    Forse è colpa del mio file crt0?? Posto il codice :
    codice:
    .global _start
    
    _start : 
    	nop 
    	call _main 
    
    	
    
    	mov $1, %eax
    	mov $0, %ebx
    	int $0x80
    Ma il prametro -lc che indica al linker???

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.