Error gfxglyph does not name a type

I run GLUE_Demo_480x320, it working good, but I want to use FreeDefaultFonts.h I'm comment #undef GFXFONT_H //comment this line to enable FreeFonts in UTFTGLUE, i have "exit status 1 '...

@fizzmann

I run GLUE_Demo_480x320,

it working good, but I want to use FreeDefaultFonts.h
I’m comment #undef GFXFONT_H //comment this line to enable FreeFonts in UTFTGLUE,

i have
«exit status 1
‘GFXglyph’ does not name a type»

@prenticedavid

I just built the GLUE_Demo_480x320 example from the v2.9.7 Release on GitHub.
However, I am actually using the Master Branch currently on GitHub (Beta).

It built and ran on Mega2560. I commented the undef. It built and ran on the Mega2560.
It is difficult to distinguish between the FreeSmallFont and the regular Adafruit 7×5 system font.

If you are an ordinary Arduino user:
I strongly recommend that you delete any old directories and install a «Release» with the Library Manager.
There is seldom anything to be gained by using the latest Beta. (unless it is some new unseen hardware)

If you are a GitHub member and have cloned/forked a Repository, you can use GitHub to select any historic release. But please say exactly what release you are using.

David.

@fizzmann

I strongly recommend that you delete any old directories and install a «Release» with the Library Manager.

Works, Thanks ;]

@fizzmann

but I didn’t set a BACK color
tft.setBackColor(YELLOW);
tft.setTextColor(GREEN, YELLOW);
on Adafruit 7×5 font work good

@prenticedavid

The FreeFonts only render as transparent. You have to re-paint any background colour before printing.

From memory, I kludge rubout printing with the UTFTGLUE class.

One day I might offer rubout printing but this would violate all the GFX tutorials and documentation.

David.

@chirath123

pls help quickly
i use utftglue.h file but i can’t use the font.

@chirath123

how i resolve this problem.

@prenticedavid

Run the GLUE_320x240 demo. Observe the Title font. Especially the width.
Then edit UTFTGLUE.h to comment the #undef line.

Run the GLUE_320x240 demo. Observe the different font.
Most UTFT example sketches will work with the UTFTGLUE class.

If you have a problem, quote which UTFT example. I will help you.
If you have a new project, you would use the native GFX methods instead of UTFTGLUE.

If you have a general problem with your project, it is better to attach files, ask questions on the Arduino.cc Displays Forum. GitHub is for library source code or usage questions.

David.

@chirath123

thank you very much!
but how i use custom or other fonts ??

@prenticedavid

Please be positive and constructive with your questions and comments.

User avatar

sekramer10

 
Posts: 179
Joined: Wed Oct 28, 2015 12:42 am

Change font for Max72xxPanel library ?

I am trying to define a font using the Max72xxPanel library for a scrolling text project but I get the error:

Code: Select all

C:UsersPerigalacticonDocumentsArduinosketchesMAX7219_ticker_example_mod1MAX7219_ticker_example_mod1.ino: In function 'void setup()':

MAX7219_ticker_example_mod1:24: error: 'class Max72xxPanel' has no member named 'setFont'

   matrix.setFont(&visitor19pt7b);

          ^

I have run the original ticker example sketch from the library and it works fine but I need to use a smaller font for my project though. «visitor19pt7b» is a custom font I made, but I also specified one of the existing fonts from the library with the same error. Should I be able to change the font? Thanks.


User avatar

sekramer10

 
Posts: 179
Joined: Wed Oct 28, 2015 12:42 am

Re: Change font for Max72xxPanel library ?

Post

by sekramer10 » Fri Jul 28, 2017 12:52 am

I tried to modify the library files to make this work. In the .h file I added this function:

In the CPP file I added this function:

Code: Select all

void Max72xxPanel_with_setFont::setFont(const Adafruit_GFX::GFXfont *f) {  // added
	Adafruit_GFX::setFont(*f)	
}

Then I get the errors:

Code: Select all

visitor19pt7b.h:76: error: 'GFXglyph' in 'class Adafruit_GFX' does not name a type

 const Adafruit_GFX::GFXglyph visitor19pt7bGlyphs[] PROGMEM = {

                     ^

visitor19pt7b.h:173: error: 'GFXfont' in 'class Adafruit_GFX' does not name a type

 const Adafruit_GFX::GFXfont visitor19pt7b PROGMEM = {

                     ^

C:UsersPerigalacticonDocumentsArduinosketchesMAX7219_ticker_example_mod1MAX7219_ticker_example_mod1.ino: In function 'void setup()':

MAX7219_ticker_example_mod1:24: error: 'visitor19pt7b' was not declared in this scope

   matrix.setFont(&visitor19pt7b);

                   ^

Could you please help me make his work?

Thanks.




User avatar

sekramer10

 
Posts: 179
Joined: Wed Oct 28, 2015 12:42 am

Re: Change font for Max72xxPanel library ?

Post

by sekramer10 » Sat Sep 02, 2017 11:20 pm

Sorry for the late reply, but now I’m trying to get something working for this weekend. I searched for the forum post you mentioned but no luck. Could you post your code, because I did have the font included last when I get the errors. Did you also modify the Max72xxPanel library to include the setfont() function? This is my current sketch:

Code: Select all

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Max72xxPanel_with_setFont.h>
#include <avr/pgmspace.h>
//#include <MAX7219_AmFlag_Bitmaps.h>
#include <Fonts/visitor19pt7b.h>
//#include "visitor19pt7b.h"


int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf http://arduino.cc/en/Reference/SPI )
int numberOfHorizontalDisplays = 1;
int numberOfVerticalDisplays = 1;
String tape = "Arduino";
int wait = 1000; // In milliseconds
int spacer = 2;
int width = 5 + spacer;

Max72xxPanel_with_setFont matrix = Max72xxPanel_with_setFont(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);

void setup()
{
  matrix.setFont(&visitor19pt7b, 9);
  matrix.setIntensity(15); 
  matrix.setTextWrap(false);
  //  matrix.setFont();
  matrix.setRotation(0, 1);    
}

void loop()
{
  for ( int i = 0 ; i < width * tape.length() + matrix.width() - 1 - spacer; i++ )
  {
    matrix.fillScreen(LOW);
    int letter = i / width;
    int x = (matrix.width() - 1) - i % width;
    int y = (matrix.height() - 8) / 2;
    while ( x + width - spacer >= 0 && letter >= 0 )
    {
      if ( letter < tape.length() )
      {
        matrix.drawChar(x, y, tape[letter], HIGH, LOW, 1);
      }
      letter--;
      x -= width;
    }
    matrix.write();
    delay(wait);
  }
}

And this is the error:

Code: Select all

C:UsersPerigalacticonDocumentsArduinosketchesProjectsAmerican Flag DislpayMAX7219_ticker_example_mod1MAX7219_ticker_example_mod1.ino: In function 'void setup()':

MAX7219_ticker_example_mod1:22: error: no matching function for call to 'Max72xxPanel_with_setFont::setFont(const GFXfont*, int)'

   matrix.setFont(&visitor19pt7b, 9);

                                   ^

C:UsersPerigalacticonDocumentsArduinosketchesProjectsAmerican Flag DislpayMAX7219_ticker_example_mod1MAX7219_ticker_example_mod1.ino:22:35: note: candidate is:

In file included from C:UsersPerigalacticonDocumentsArduinosketchesProjectsAmerican Flag DislpayMAX7219_ticker_example_mod1MAX7219_ticker_example_mod1.ino:3:0:

C:Program Files (x86)ArduinolibrariesMax72xxPanel_with_setFont/Max72xxPanel_with_setFont.h:69:7: note: void Max72xxPanel_with_setFont::setFont(const GFXfont*)

  void setFont(const GFXfont*f);  // added

       ^

C:Program Files (x86)ArduinolibrariesMax72xxPanel_with_setFont/Max72xxPanel_with_setFont.h:69:7: note:   candidate expects 1 argument, 2 provided

Multiple libraries were found for "Adafruit_GFX.h"
 Used: C:Program Files (x86)ArduinolibrariesAdafruit_ssd1306syp
 Not used: C:Program Files (x86)ArduinolibrariesAdafruit-GFX-Library
 Not used: C:Program Files (x86)ArduinolibrariesAdafruit-GFX-Library
 Not used: C:Program Files (x86)ArduinolibrariesAdafruit-GFX-Library
 Not used: C:Program Files (x86)ArduinolibrariesAdafruit-GFX-Library
exit status 1
no matching function for call to 'Max72xxPanel_with_setFont::setFont(const GFXfont*, int)'


Please be positive and constructive with your questions and comments.


Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

The Arduino software is an open-source and easy to use platform which configures the Arduino board into functioning in a certain way. An Arduino code is written in C++ but with additional functions and methods. An Arduino is a hardware and software platform widely used in electronics.

In this article, we will see a few quick fixes for the error ‘does not name a type‘ or the ‘no such file or directory‘ error.

Also read: How to stop an Arduino program?


What does the error mean?

In almost every coding language known to man, every variable has a specific data type. In general, there are multiple data types like int indicating integer, float for decimal values, char and String for alphabets and sentences, boolean for true or false and many more. In Arduino, there are 16 data types commonly used.

  • void: Used in function declarations, and indicates that the function will not return anything.
  • boolean: It is a true or false value.
  • char: Stores a character value in one byte of the memory.
  • Unsigned char: Unsigned data type which encodes numbers between 0 and 255 and occupies one byte of the memory.
  • byte: It is an 8-bit unsigned number holding a value between 0 and 255.
  • int: It is a primary data type which stores a 16-bit integer value. It can store negative values.
  • Unsigned int: Unsigned integer that stores only positive integer values in the 2 byte memory.
  • long: It is a 32-bit memory for storing numbers, both positive and negative.
  • Unsigned long: Unsigned long variables store only positive numbers in the 32-bit memory storage.
  • short: It is a 16-bit data type storing positive and negative numbers.
  • float: It is a decimal value having a 32-bit memory.
  • double: It is a double floating number having either 32 or 64 bit memory depending on the board.
  • word: Based on the type of board, it stores either 16-bit or 32-bit unsigned number.
  • array: It is a collection of variables which is accessible using index numbers.
  • String-char array: Converts the string into an array of characters.
  • String-object: Class which can be used to manipulate, concatenate and perform other operations on strings and arrays.

The error ‘does not name a type‘ or the ‘no such file or directory‘ are errors that occur during the compilation process. They generally indicate missing data types or wrongly used data types. It may also indicate missing directories or libraries.

Also read: Arduino UNO vs Arduino Mega.


Here are two ways to fix the error.

Check data type

Every user-defined function and variable initialised or declared in the code should have a corresponding data type. The data type of the variable or function should also coincide with the value being stored or returned.

Consider a small example sample code below.

What is 'does not name a type' in Arduino: 2 Fixes

Here the function MQRead is of the type float. The variables i and mq_pin are integer type, while rs is float type. In the for loop, i is given the value 0, an integer value. The analogRead function always reads an integer value, which is being assigned to the mq_pin variable. Since the value or type for rs, the float type suffices for any value assigned to it as a result of the calculation. The user-defined function MQRead is of type float, which means that the return type for it is float, which is achieved by returning the value of rs for the function.

The error occurs if any of these data types don’t stand to the data being stored in the variables. Always check and recheck the data type for every variable, function and return type.


Library folder

In many cases, you may use libraries that are not standard or included in Arduino. But Arduino is flexible with the import of new libraries, making it easy to use all functions from any library. Follow the path below to check the currently available libraries in your Arduino software.

My Documents -> Arduino -> Libraries

Consider the snippet of code below. There are four library folders that are included for the code to work. But these aren’t a part of the standard library of Arduino.

What is 'does not name a type' in Arduino: 2 Fixes

There are two ways to import a library to the Arduino.


Method 1

Step 1: Click on Sketch on the top left panel of the window. Go to the include Library option and select Manage Libraries.

Keyboard Shortcut: Ctrl+Shift+I.

What is 'does not name a type' in Arduino: 2 Fixes

Step 2: Search or select from the options available and click on Install.

Note that a few Libraries may not be available if your software isn’t updated with the latest version.

What is 'does not name a type' in Arduino: 2 Fixes

All the libraries you are planning to use may not be easily found under the Manage Libraries section. In such cases, we use Method 2 for importing the libraries.


Method 2

Step 1: Download a zip file for the library from GitHub or any other reliable source present online.

Step 2: Click on Sketch on the top left panel of the window. Go to the include Library option and select Add ZIP Library.

What is 'does not name a type' in Arduino: 2 Fixes

Step 3: Set the file type to be ZIP files and folders.

Step 4: Go to the download location of the zip file and select it. Click on Open.

What is 'does not name a type' in Arduino: 2 Fixes

The library is successfully added to the Arduino software now.

Also read: NodeMCU vs Arduino vs Raspberry Pi.

0 / 0 / 0

Регистрация: 08.08.2021

Сообщений: 14

1

08.08.2021, 17:03. Показов 2447. Ответов 7


Учу c++, пишу небольшую програмку которая должна выдавать и обновлять статусы заданий по имени программиста. Упёрся в вот такую ошибку, в интернете ничего на тему не нашёл, хелп!

Ошибка компиляции:
/exposed/submission/submission.cpp:21:19: error: ‘map’ does not name a type
21 | using TasksInfo = map<TaskStatus, int>;
| ^~~
compilation terminated due to -Wfatal-errors.

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <map>
#include <string>
#include <tuple>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <set>
#include <utility>
 
enum class TaskStatus {
    NEW,          // новая
    IN_PROGRESS,  // в разработке
    TESTING,      // на тестировании
    DONE          // завершена
};
 
using TasksInfo = map<TaskStatus, int>;
 
class TeamTasks {
public:
    const TasksInfo& GetPersonTasksInfo(const string& person) const{
        const TasksInfo person_task_copy = person_tasks[person];
        return person_task_copy;
    }
 
    // Добавить новую задачу (в статусе NEW) для конкретного разработчитка
    void AddNewTask(const string& person) {
            ++person_tasks[person][TaskStatus::NEW];
    }
    tuple<TasksInfo, TasksInfo> PerformPersonTasks(const string& person, int task_count) {
        TasksInfo updated;
        TasksInfo unupdated;
        TasksInfo toiter = person_tasks[person];
        for(const auto&[stat,count]:toiter){
        if(count>=task_count){
            person_tasks[person][stat] -= count - task_count;
            person_tasks[person][stat+1]
            updated[stat] += task_count;
            unupdated[stat] += count - task_count;
            task_count = 0;
            return {updated, unupdated};
        }
        else{
            person_tasks[person][stat] = 0;
            person_tasks[person][stat+1] += count;
            updated[stat] += count;
            task_count -= count;
        }
    }
        return{updated,unupdated};
}
private:
    map<string, TasksInfo> person_tasks;
};
 
void PrintTasksInfo(TasksInfo tasks_info) {
    cout << tasks_info[TaskStatus::NEW] << " new tasks"s <<
        ", "s << tasks_info[TaskStatus::IN_PROGRESS] << " tasks in progress"s <<
        ", "s << tasks_info[TaskStatus::TESTING] << " tasks are being tested"s <<
        ", "s << tasks_info[TaskStatus::DONE] << " tasks are done"s << endl;
}
 
int main() {
    TeamTasks tasks;
    tasks.AddNewTask("Ilia"s);
    for (int i = 0; i < 3; ++i) {
        tasks.AddNewTask("Ivan"s);
    }
    cout << "Ilia's tasks: "s;
    PrintTasksInfo(tasks.GetPersonTasksInfo("Ilia"s));
    cout << "Ivan's tasks: "s;
    PrintTasksInfo(tasks.GetPersonTasksInfo("Ivan"s));
 
    TasksInfo updated_tasks, untouched_tasks;
 
    tie(updated_tasks, untouched_tasks) =
        tasks.PerformPersonTasks("Ivan"s, 2);
    cout << "Updated Ivan's tasks: "s;
    PrintTasksInfo(updated_tasks);
    cout << "Untouched Ivan's tasks: "s;
    PrintTasksInfo(untouched_tasks);
 
    tie(updated_tasks, untouched_tasks) =
        tasks.PerformPersonTasks("Ivan"s, 2);
    cout << "Updated Ivan's tasks: "s;
    PrintTasksInfo(updated_tasks);
    cout << "Untouched Ivan's tasks: "s;
    PrintTasksInfo(untouched_tasks);
}

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Понравилась статья? Поделить с друзьями:
  • Error getting status no server lines in license file
  • Error getting status invalid license file syntax
  • Error getting smart parameters cannot open device
  • Error getting server certificate
  • Error getting response перевод