C++: multiple definition...?

Hallo, ich habe in C++ einen Header erstellt, aber bei der Complierung kommt immer diese Fehlermeldung:

C:\Users\Admin\AppData\Local\Temp\ccdaLGOT.o:lexer.cpp:(.text+0x111): undefined reference to `Token::content[abi:cxx11]() const'
...(Zu lang zum abschicken)
collect2.exe: error: ld returned 1 exit status

Kann mir jemand sagen was der Fehler ist und wie ich ihn behebe?

token.hpp:

#ifndef TOKEN_HPP_
#define TOKEN_HPP_

#include <string>

class Token {
public:
    enum class Type {
        STRING,
        NUMBER,
        BOOLEAN,
        IDENTIFIER,
        EQUAL,
        PLUS,
        MINUS,
        TIMES,
        DIVIDE,
        LESS_THAN,
        GREATER_THAN,
        COMMENT,
        DOT,
        COMMA,
        SEMICOLON,
        CURLY_BRACKET_RIGHT,
        CURLY_BRACKET_LEFT,
        APOSTROPHE,
        COLON,
        UNEXPECTED
    };

    Token                (Type type)              noexcept;

    Type type            ()                       const noexcept;

    bool is                (Type type)               const noexcept;

    bool is_not            (Type type)               const noexcept;

    std::string content ()                       const noexcept;

    void change_content (std::string content)  const noexcept;

    void add_to_content (std::string content)  const noexcept;

    void clear_content  ()                       const noexcept;

    void change_type    (Type type)            const noexcept;

private:
    Type m_type;
    std::string m_content;
};

#endif

token.cpp:

#include "token.hpp"

#include <string>

Token::Token(Type type) noexcept : m_type{type} {};

Token::Type Token::type() const noexcept {
    return m_type;
}

bool Token::is(Type type) const noexcept {
    return m_type == type;
}

bool Token::is_not(Type type) const noexcept {
    return m_type != type;
}

std::string Token::content() const noexcept {
    return m_content;
}

void Token::change_content(std::string content) const noexcept {
    m_content = content;
}

void Token::add_to_content(std::string content) const noexcept {
    m_content = m_content + content;
}

void Token::clear_content() const noexcept {
    m_content.clear(); //Die clear Funktion geht auch nicht
}

void Token::change_type(Type type) const noexcept {
    m_type = type;
}

Ich hoffe jemand kann mir dabei helfen!

LG

PC, Computer, Software, programmieren, compiler, Cplusplus, CPP, development, Informatik, Informatiker, Programmiersprache, C (Programmiersprache), Cpp Programierung
SwiftUI Search Bar mit Liste?

Ich möchte für meine Liste eine SearchBar implementieren, was ursprünglich auch funktioniert hat, allerdings habe ich ein paar Sachen umgeschrieben und jetzt funktioniert es nicht mehr.

Warum und wie behebe ich es?

struct Elementis: Identifiable{
    var id = UUID()
    var order: String
    var ename: String   
}
let Chemics = [
    Elementis(order: "1", ename: "Wasserstoff"),
    Elementis(order: "2", ename: "Helium"),
    Elementis(order: "3", ename: "Lithium"),
    Elementis(order: "4", ename: "Beryllium"),
    Elementis(order: "5", ename: "Bor"),
]
import SwiftUI

    @State private var searchText = ""
    var Element: [Elementis] = Chemics

 var body: some View{
   List{
                ForEach(Element) { elementis in
                    HStack{
                        NavigationLink(elementis.ename,
                                       destination: Aluminium())
                        
                        //Text(elementis.order)
                    }
                }
           
                
            }
            .navigationTitle("Chemie")
            .searchable(text: $searchText, prompt: "Element suchen...")



}

 var searchResults: [String] {
           if searchText.isEmpty {
               return Element.ename
           } else {
               return Element.ename.filter { $0.contains(searchText) }
           }
       }
}

 

Es kann sein, dass einige Klammern hier auf GuteFrage fehlen, diese sind aber im Programm definitiv drin.

Der Fehler taucht unter "var searchResults" auf und sagt mir je nachdem was ich einsetze verschiedene Meldungen an.

Meistens sind es folgende Meldungen:

"Cannot convert return expression of type 'String' to return type '[String]' "

"Value of type '[Elementis]' has no member 'ename' "

Über ein wenig Hilfe würde ich mich freuen. Besten Dank im Voraus

PC, Computer, Internet, programmieren, Swift, SwiftUI
CSS3-Keyframe-Aninationen bei mouseout rückgängig machen?

Hi, ich habe diese Keyframe-Animationen in CSS gemacht:

nav:hover #strich1 {
    animation: strich1 0.5s ease-out 0s 1 normal forwards;
}
nav:hover #strich2 {
    animation: strich2 0.5s ease-out 0s 1 normal forwards;
}
nav:hover #strich3 {
    animation: strich3 0.5s ease-out 0s 1 normal forwards;
}
@keyframes strich1 {
    from {
        transform: rotate(0deg);
        width: 24px;
    }
    to {
        transform: rotate(45deg);
        width: 30px;
    }
}
@keyframes strich2 {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}
@keyframes strich3 {
    from {
        transform: rotate(0deg);
        width: 24px;
    }
    to {
        transform: rotate(-45deg);
        width: 30px;
    }
}

möchte ihr allerdings auch, dass sie sobald die Maus den Navigationsbereich(<nav>) wieder verlässt die Animationen wieder rückwärts ablaufen, weiß allerdings noch nicht so ganz wie. Ich habe es bereits so versucht:

nav:not(:hover) #strich1 {
    animation: strich1 0.5s ease-out 0s 1 reverse forwards;
}
...

und so:

nav #strich1 {
    animation: strich1 0.5s ease-out 0s 1 reverse forwards;
}
...

Hat allerdings beides nicht den gewünschten Effekt gebracht. Wisst ihr wie ich das machen könnte? Gibt es vllt eine Art Gegenteil-Pseudoklasse zu :hover? Wisst ihr da Abhilfe? Ansonsten hatte ich mir noch überlegt mit JavaScript nach dem feuern des mouseout events die Animation rückgängig zu machen wenn das mit CSS gar nicht geht.

PC, Computer, HTML, CSS, Webentwicklung, Keyframes
Grafikkarte wird nicht erkannt, und wenn ich den Treiber aktualisieren möchte wird der Monitor Schwarz?

Guten Tag,

Ich hätte da eine Frage an die Leute die sich gut mit so Computern auskennen. Ich wollte Vorgestern auf Locker was Spielen mit einem Kumpel. Doch dann hab ich bemerkt, das ich anstatt meine 144 Hertz habe. Auf einmal es Automatisch auf 64 gestellt. Ich kann dies auch nicht ändern. Dann hab ich auch bemerkt das die Lüfter auch bissen Lauter sind. Guck ich im Taskmanager CPU ist auf volle Ausleistung. Das hat mich auch schon dick abgefuckt. Aber dazu finde ich meine GPU im Taskmanager nicht, hat aber glaube ich auch nichts zu bedeuten oder? Da die Lüfter der GPU sich normal drehten. Dann hab ich das Spiel Fortnite gestartet jedoch kam dieser Fehler D3D11. Danach hab ich mich Informiert und hab herausbekommen das man am besten den Treiber aktualisieren soll. Danach hab ich ihn heruntergeladen, aber als er installieren wollte wurde auf einmal mein Monitor schwarz. Meine Grafikkarte drehte sich auch nicht mehr. Dann hab ich ihn neu gestartet, Hing mein Monitor nochmal. Danach starte ich ihn wieder neu jedoch hing er nochmal. Und beim dritten mal ging es.

Ich habe echt keine Ahnung was ich machen soll. War am überlegen Windows 10 neu zu installieren. Aber bevor ich das tue hole ich mir am besten Infos von Profis. Wenn ich irgendwas falsch gesagt habe korrigiert mich bitte.

Kuss an dem der mir hilft.

LG

Bild zum Beitrag
PC, Computer, Grafikkarte, Treiber

Meistgelesene Beiträge zum Thema PC