Aller au contenu

Erreur de compilation arduino mega2560


Messages recommandés

Bonjour je suis bloqué sur ces messages d'erreur quelqu'un peux m'aider.

Arduino : 1.8.18 (Windows 10), Carte : "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\slyay\AppData\Local\Temp\cckehf3g.ltrans0.ltrans.o: In function `main':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
exit status 1
Erreur de compilation pour la carte Arduino Mega or Mega 2560


Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.
 

Lien vers le commentaire
Partager sur d’autres sites

Salut et bienvenue sur le forum,

Franchement avec aussi peu d'informations, il est difficile de te venir en aide.🥴

Est-ce que tu essaies de compiler Marlin?

  • si oui, quelle version?
  • si non, peux-tu fournir ton projet pour que l'on essaie de le compiler?
  • +1 1
Lien vers le commentaire
Partager sur d’autres sites

Salutation !

Je voulais répondre comme notre ami @pommeverte. c-a-d "Manque d'infos. Pas simple d'aider avec juste cela."

 

Mais je me suis dis,

allez faisons une recherche google, au pif de

Il y a 9 heures, Babaste1732 a dit :

main.cpp:46: undefined reference to `loop'

!

( cf https://www.google.com/search?q=main.cpp%3A46%3A+undefined+reference+to+`loop' )

 

et je trouve https://forum.arduino.cc/t/troubleshooting-undefined-reference-to-setup-loop-error/480678 

/* Liquid flow rate sensor -DIYhacking.com Arvind Sanjeev Measure the liquid/water flow rate using this code. Connect Vcc and Gnd of sensor to arduino, and the signal line to arduino digital pin 2. */ byte statusLed = 13; byte sensorInterrupt = 0; // 0 = digital pin 2 byte sensorPin = 2; // The hall-effect flow sensor outputs approximately 4.5 pulses per second per // litre/minute of flow. float calibrationFactor = 4.5; volatile byte pulseCount; float flowRate; unsigned int flowMilliLitres; unsigned long totalMilliLitres; unsigned long oldTime; void setup() { // Initialize a serial connection for reporting values to the host Serial.begin(38400); // Set up the status LED line as an output pinMode(statusLed, OUTPUT); digitalWrite(statusLed, HIGH); // We have an active-low LED attached pinMode(sensorPin, INPUT); digitalWrite(sensorPin, HIGH); pulseCount = 0; flowRate = 0.0; flowMilliLitres = 0; totalMilliLitres = 0; oldTime = 0; // The Hall-effect sensor is connected to pin 2 which uses interrupt 0. // Configured to trigger on a FALLING state change (transition from HIGH // state to LOW state) attachInterrupt(sensorInterrupt, pulseCounter, FALLING); } /** * Main program loop */ void loop() { if((millis() - oldTime) > 1000) // Only process counters once per second { // Disable the interrupt while calculating flow rate and sending the value to // the host detachInterrupt(sensorInterrupt); // Because this loop may not complete in exactly 1 second intervals we calculate // the number of milliseconds that have passed since the last execution and use // that to scale the output. We also apply the calibrationFactor to scale the output // based on the number of pulses per second per units of measure (litres/minute in // this case) coming from the sensor. flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor; // Note the time this processing pass was executed. Note that because we've // disabled interrupts the millis() function won't actually be incrementing right // at this point, but it will still return the value it was set to just before // interrupts went away. oldTime = millis(); // Divide the flow rate in litres/minute by 60 to determine how many litres have // passed through the sensor in this 1 second interval, then multiply by 1000 to // convert to millilitres. flowMilliLitres = (flowRate / 60) * 1000; // Add the millilitres passed in this second to the cumulative total totalMilliLitres += flowMilliLitres; unsigned int frac; // Print the flow rate for this second in litres / minute Serial.print("Flow rate: "); Serial.print(int(flowRate)); // Print the integer part of the variable Serial.print("."); // Print the decimal point // Determine the fractional part. The 10 multiplier gives us 1 decimal place. frac = (flowRate - int(flowRate)) * 10; Serial.print(frac, DEC) ; // Print the fractional part of the variable Serial.print("L/min"); // Print the number of litres flowed in this second Serial.print(" Current Liquid Flowing: "); // Output separator Serial.print(flowMilliLitres); Serial.print("mL/Sec"); // Print the cumulative total of litres flowed since starting Serial.print(" Output Liquid Quantity: "); // Output separator Serial.print(totalMilliLitres); Serial.println("mL"); // Reset the pulse counter so we can start incrementing again pulseCount = 0; // Enable the interrupt again now that we've finished sending output attachInterrupt(sensorInterrupt, pulseCounter, FALLING); } } /* Insterrupt Service Routine */ void pulseCounter() { // Increment the pulse counter pulseCount++; }

où semble t'il, il suffit d'ajouter des retours a la lignes car sinon le compilateur va prendre tout ce qu'il y a dernier "//" pour des commentaire et échouer.

En gros il faut que cela soit transformé en un truc comme ce qui suit (avec des retour a la ligne là où il faut ! mais j'ai pas testé une compilation )


    /**
     * Liquid flow rate sensor -DIYhacking.com Arvind Sanjeev Measure the
     * liquid/water flow rate using this code. Connect Vcc and Gnd of sensor to
     * arduino, and the signal line to arduino digital pin 2.
     */
    byte statusLed = 13;
    byte sensorInterrupt = 0;
    // 0 = digital pin 2 
    byte sensorPin = 2;
    // The hall-effect flow sensor outputs approximately 4.5 pulses per second per 
    // litre/minute of flow. 
    float calibrationFactor = 4.5;
    volatile byte pulseCount;
    float flowRate;
    unsigned int flowMilliLitres;
    unsigned long totalMilliLitres;
    unsigned long oldTime;

    void setup() {
        // Initialize a serial connection for reporting values to the host 
        Serial.begin(38400);
        // Set up the status LED line as an output 
        pinMode(statusLed, OUTPUT);
        digitalWrite(statusLed, HIGH);
        // We have an active-low LED attached 
        pinMode(sensorPin, INPUT);
        digitalWrite(sensorPin, HIGH);
        pulseCount = 0;
        flowRate = 0.0;
        flowMilliLitres = 0;
        totalMilliLitres = 0;
        oldTime = 0;
        // The Hall-effect sensor is connected to pin 2 which uses interrupt 0. 
        // Configured to trigger on a FALLING state change (transition from HIGH 
        // state to LOW state) 
        attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
    }

    /**
     * Main program loop
     */
    void loop() {

        if ((millis() - oldTime) > 1000) // Only process counters once per second 
        {
            // Disable the interrupt while calculating flow rate and sending the value to 
            // the host 
            detachInterrupt(sensorInterrupt);
            // Because this loop may not complete in exactly 1 second intervals we calculate 
            // the number of milliseconds that have passed since the last execution and use 
            // that to scale the output. We also apply the calibrationFactor to scale the output 
            // based on the number of pulses per second per units of measure (litres/minute in 
            // this case) coming from the sensor. 
            {
                flowRate = ((1000.0 / (millis() - oldTime)) * pulseCount) / calibrationFactor;
            }

            // Note the time this processing pass was executed. Note that because we've 
            // disabled interrupts the millis() function won't actually be incrementing right 
            // at this point, but it will still return the value it was set to just before 
            // interrupts went away. 
            oldTime = millis();
            // Divide the flow rate in litres/minute by 60 to determine how many litres have 
            // passed through the sensor in this 1 second interval, then multiply by 1000 to 
            // convert to millilitres. 
            flowMilliLitres = (flowRate / 60) * 1000;
            // Add the millilitres passed in this second to the cumulative total 
            totalMilliLitres += flowMilliLitres;
            unsigned int frac;

            // Print the flow rate for this second in litres / minute 
            Serial.print("Flow rate: ");
            Serial.print(int(flowRate));
            // Print the integer part of the variable 
            Serial.print(".");
            // Print the decimal point 
            // Determine the fractional part. The 10 multiplier gives us 1 decimal place. 
            frac = (flowRate - int(flowRate)) * 10;
            Serial.print(frac, DEC);
            // Print the fractional part of the variable 
            Serial.print("L/min");
            // Print the number of litres flowed in this second 
            Serial.print(" Current Liquid Flowing: ");
            // Output separator 
            Serial.print(flowMilliLitres);
            Serial.print("mL/Sec");
            // Print the cumulative total of litres flowed since starting 
            Serial.print(" Output Liquid Quantity: ");
            // Output separator 
            Serial.print(totalMilliLitres);
            Serial.println("mL");
            // Reset the pulse counter so we can start incrementing again 
            pulseCount = 0;
            // Enable the interrupt again now that we've finished sending output 
            attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
        }
    }

    /**
     * Insterrupt Service Routine
     */
    void pulseCounter() {
        // Increment the pulse counter 
        pulseCount++;
    }

🙂 

Modifié (le) par PPAC
  • +1 1
Lien vers le commentaire
Partager sur d’autres sites

Merci à vous pour ces réponses je travaille avec visual studio code et marlin.

Mon projet est de configurer une creality cr10 S5 avec une tête bondtech et un Bltouch

J'ai contrôlé les lignes elles sont bien retour à la ligne suivante

C'est ma première programmation vous pouvez me dire ce que vous avez besoin

Merci 

Voici mes fichiers

Configuration_adv.h Configuration.h

Lien vers le commentaire
Partager sur d’autres sites

Salut,

Déjà, tu pars sur de très mauvaises bases 😱. La version bugfix est plutôt réservée aux bêta-testeurs.😉

Je te conseille trèèèèèèèèèèès fortement de choisir la dernière version stable de Marlin (V2.1.2.1) ou au pire la version Marlin Patched Source.

Pour info, tu as ce tuto qui explique comment compiler Marlin sous visual Studio code.

  • Merci ! 1
Lien vers le commentaire
Partager sur d’autres sites

Merci pour ta réponse dès que j'ai un moment je vais essayer avec ce tuto mais la compil que je t'ai envoyé c'est une copine où je suis revenu sur un ancien logiciel pour essayer j'avais vu ça sur des tutos mais au départ j'étais  sur la dernière version

Désolé pour la faute c'est une copie

Lien vers le commentaire
Partager sur d’autres sites

Salut,

J'ai préparé les fichiers de configuration à partir de tes fichiers et ceux donnés en exemple pour la dernière version stable de Marlin (v2.1.2.2):

Configuration.hConfiguration_adv.h_Bootscreen.h_Statusscreen.h

La compilation se termine sans erreur.🥳

J'ai fait les hypothèses suivantes:

  • BLtouch branché sur le connecteur Z-
  • pas de détecteur de présence de filament

J'ai un doute sur la déclaration de l'écran. Par défaut , c'est le "REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER" alors que l'écran ressemble à celui des CR10 standard 🤨. J'ai donc changé pour CR10_STOCKDISPLAY. A toi de voir lors du 1er démarrage si c'était une erreur 😅.

  • Merci ! 1
Lien vers le commentaire
Partager sur d’autres sites

Bonsoir les configurations je les ai ouvertes avec visual studio code. Quand je veux faire le téléversement j'ai 80 messages d'erreur je cherche et je ne comprends pas pourquoi sinon j'ai essayé avec Arduino mais il ne veut pas prendre les configurations.

Il me dit que c'est pas au bon format.

Au sujet du bltouche il est branché directement sur la carte mère et effectivement je n'ai pas de détecteur de présence de filament et j'ai un écran standard de CR 10.

Je dois certainement faire des mauvaises manipulations ou alors je suis très mauvais.

 

Lien vers le commentaire
Partager sur d’autres sites

Salut,

Il y a 1 heure, Babaste1732 a dit :

les configurations je les ai ouvertes avec visual studio code. Quand je veux faire le téléversement j'ai 80 messages d'erreur je cherche et je ne comprends pas pourquoi

moi non plus 🤨. Est-ce que tu as bien suivi le tutoriel?

  1. tu as décompressé les sources Marlin V2.1.2.2 dans un dossier le plus proche possible de la racine (C:)
  2. tu as écrasé les fichiers marlin/configuration.h et marlin/configuration_adv.h existant par ceux que j'ai fournis
  3. tu as lancé la compilation

C'est à ce moment là que tu as eu les erreurs? 🤔

Pour mémoire: téléverser = transférer ; compiler = créer le firmware (fichier hex).

 

Lien vers le commentaire
Partager sur d’autres sites

Créer un compte ou se connecter pour commenter

Vous devez être membre afin de pouvoir déposer un commentaire

Créer un compte

Créez un compte sur notre communauté. C’est facile !

Créer un nouveau compte

Se connecter

Vous avez déjà un compte ? Connectez-vous ici.

Connectez-vous maintenant
×
×
  • Créer...