Serielle Schnittstelle



  • Hallo, hoffe ihr könnt mir weiter helfen möchte unter gcc (OS 😵 eine Serielle Schnittstelle ansprechen:
    #include <stdio.h> /* Standard input/output definitions /
    #include <string.h> /
    String function definitions /
    #include <unistd.h> /
    UNIX standard function definitions /
    #include <fcntl.h> /
    File control definitions /
    #include <errno.h> /
    Error number definitions /
    #include <termios.h> /
    POSIX terminal control definitions */
    // 'open_port()' - Open serial port 1.

    int main(void){
    int fd; /* File descriptor for the port */
    fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NDELAY);
    if (fd == -1){
    perror("open_port: Unable to open /dev/ttyS0 - ");} //Could not open the port.
    else
    fcntl(fd, F_SETFL, 0);
    return (fd);}

    Darauf kommt dann folgende Meldung:
    gcc ft-1.cpp -o ft
    Undefined symbols:
    "___gxx_personality_v0", referenced from:
    ___gxx_personality_v0$non_lazy_ptr in ccLXu0a1.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    Ich bedanke für eure mithilfe da ich nicht weiß das der compiler mit der Undefined Meldung meint beziehungsweise wie ich das Problem angehen könnte



  • Für C sollte die Datei *.c heißen und mit gcc kompiliert werden.
    Für C++ die Endung .cpp und Compiler g++.




Anmelden zum Antworten