error: expected primary-expression before '*' token

I'm fairly new to this, so I apologize in advance if this ends up being a stupid/easy fix.

I'm taking an existing hydroponics controller using a MEGA 2560 and I plan on customizing it to my own liking and desires but the first order of business was simply to get the existing code to work. I thought this would be much easier but the code is from over a year ago and I keep finding syntax changes that are resulting in compiling errors. Anyway, all the code is listed below for the Window Controller Menu (.cpp file type (also attached), which controls the LCD (sainsmart 3.2").

This is being used with UTFT and UTouch libraries and I have already gotten another project to work with the same libraries so I don't think the error has to do with those files.

#include "WinControllerMenu.h"

WinControllerMenu::WinControllerMenu(UTFT *lcd, UTouch *touch, Sensors *sensors, Settings *settings) 
: Window(lcd,touch,sensors,settings) { }

WinControllerMenu::WinControllerMenu(const WinControllerMenu &other) : Window(other) {
for (uint8_t i = 0; i < _nControllerButtons; i++) {
_controllerButtons[i] = other._controllerButtons[i];
}
}

WinControllerMenu& WinControllerMenu::operator=(const WinControllerMenu& other) {
_lcd = other._lcd;
_touch = other._touch;
_sensors = other._sensors;
_settings = other._settings;
_buttons = other._buttons;
for (uint8_t i = 0; i < _nControllerButtons; i++) {
_controllerButtons[i] = other._controllerButtons[i];
}
return *this;
}

WinControllerMenu::~WinControllerMenu() {}

Window::Screen WinControllerMenu::getType() const {
return Window::ControllerSettings;
}

void WinControllerMenu::print() {
_soundActive = _settings->getSound();
_serialActive = _settings->getSerialDebug();

_lcd->setColor(lightGreen[0],lightGreen[1],lightGreen[2]);
_lcd->setBackColor(VGA_WHITE);
_lcd->setFont(various_symbols);

//Print bulletpoints & texts
for (uint8_t i = 0; i < _nControllerButtons - _nFlowButtons; i++) {
_lcd->print(pmChar(bulletStr),_xMenu,_yFiveLines+_bigFontSize*_yFactor5lines*i);
_controllerButtons[i + _nFlowButtons] = _buttons.addButton(_xMenu+_bigFontSize*2,_yFiveLines+_bigFontSize*_yFactor5lines*i,(char*)pgm_read_word(&controllerButtonText[i]));
}

_lcd->setFont(uint8_t* hallfetica_normal);
//Sound ON/OFF
if (_soundActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons]),_yFiveLines+_bigFontSize*_yFactor5lines*3);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons]),_yFiveLines+_bigFontSize*_yFactor5lines*3);
//Serial Debug ON/OFF
if (_serialActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons+1]),_yFiveLines+_bigFontSize*_yFactor5lines*4);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons+1]),_yFiveLines+_bigFontSize*_yFactor5lines*4);
}

//Draws entire screen Controller Settings
void WinControllerMenu::draw() { 
_lcd->fillScr(VGA_WHITE);
_buttons.deleteAllButtons();
printMenuHeader(nameWinControllerMenu);
addFlowButtons(true,false,true,_controllerButtons);
print();
_buttons.drawButtons();
}

//Redraws only controller settings text from inner temp vars
//Used when +- signs are pressed
void WinControllerMenu::update() {
_lcd->setColor(lightGreen[0],lightGreen[1],lightGreen[2]);
_lcd->setFont(uint8_t* hallfetica_normal);

//Sound ON/OFF
if (_soundActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[3]),_yFiveLines+_bigFontSize*2*3);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[3]),_yFiveLines+_bigFontSize*2*3);
//Serial Debug ON/OFF
if (_serialActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[4]),_yFiveLines+_bigFontSize*2*4);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[4]),_yFiveLines+_bigFontSize*2*4);
}

Window::Screen WinControllerMenu::processTouch(const int x, const int y) {
int buttonIndex = _buttons.checkButtons(x,y);
//Back
if (buttonIndex == _controllerButtons[0]) 
return MainMenu;
//Exit
else if (buttonIndex == _controllerButtons[2]) 
return MainScreen;
//Time & Date
else if (buttonIndex == _controllerButtons[3]) 
return TimeDate;
//Sensor polling
else if (buttonIndex == _controllerButtons[4]) 
return SensorPolling;
//SD Card
else if (buttonIndex == _controllerButtons[5]) 
return SDCard;
//Sound toggle
else if (buttonIndex == _controllerButtons[6]) {
_soundActive = !_soundActive;
_settings->setSound(_soundActive);
update();
//Serial debug toggle
} else if (buttonIndex == _controllerButtons[7]) {
_serialActive = !_serialActive;
_settings->setSerialDebug(_serialActive);
update();
}
return None;
}

These are the error messages I'm receiving:

WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::print()':
WinControllerMenu.cpp:44: error: expected primary-expression before '' token
_lcd->setFont(uint8_t
hallfetica_normal);
^
WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::update()':
WinControllerMenu.cpp:71: error: expected primary-expression before '' token
_lcd->setFont(uint8_t
hallfetica_normal);
^
expected primary-expression before '*'

WinControllerMenu.cpp (4.08 KB)

WinControllerMenu.h (2.39 KB)

UTouch.cpp (4.49 KB)

UTouch.h (1.59 KB)

UTFT.cpp (25.7 KB)

UTFT.h (7.71 KB)

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the "Code" icon above the posting area. It is the first icon, with the symbol: </>

How to use this forum

WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::print()':
WinControllerMenu.cpp:44: error: expected primary-expression before '*' token
_lcd->setFont(uint8_t* hallfetica_normal);

?? I'm surprised that this ever compiled at all. The star here is working as a multiplication sign, so it expects an expression, not a type.

What you meant to say was

_lcd->setFont( (uint8_t*) hallfetica_normal);

Thanks a bunch... but now I'm getting a different error (pasted below). Now what am I doing wrong?

C:\Users\Ryan\Documents\Arduino\libraries\Huertomato_Code-master\WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::print()':
C:\Users\Ryan\Documents\Arduino\libraries\Huertomato_Code-master\WinControllerMenu.cpp:44:16: error: 'hallfetica_normal' was not declared in this scope
_lcd->setFont(hallfetica_normal);

rmiller107:
Thanks a bunch... but now I'm getting a different error (pasted below). Now what am I doing wrong?

C:\Users\Ryan\Documents\Arduino\libraries\Huertomato_Code-master\WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::print()':
C:\Users\Ryan\Documents\Arduino\libraries\Huertomato_Code-master\WinControllerMenu.cpp:44:16: error: 'hallfetica_normal' was not declared in this scope
_lcd->setFont(hallfetica_normal);

Ok, dude, before asking us to fix your program line by line, how's about you make at least an attempt to understand what the error message means? How about you actually read it? You gotta look like you are making an effort, man. We are all happy to help someone learn, but if you simply want me to fix your problems for you then you'll have to pay me my usual rate.

'hallfetica_normal' was not declared in this scope

line 44 attempts to use a symbol (a variable) 'hallfetica_normal', and that symbol is not defined anywhere around there. So, where should it be being defined? I don't know.

What I suggest you do is start a new sketch and try to write some output to your LCD. Find out what's involved in using some particular font. Find out how to load up Hallfetica font and to get output using that. I see this all the time - people drop some massive sketch into their IDE and it doesn't work and they try to fix it. This approach is just lining yourself up for failure. You can't fix a big sketch without understanding first, how each piece works; and second, how those pieces interact to do whatever it is the sketch does.

Make a new sketch, and put 'Hello, World!" on your LCD in hallfetica_normal font.

Wow. Sorry for the novice level question but geeze. Listed below is what I have attempted to do so far.

I tried making it work with the default "SmallFont" native to the UTFT library as well, which didn't fix it.

I have tried every single way to declare a variable I could find through google searches and forum research and I get either "not declared in scope" or "expected primary expression before" or some variation of that.

I tried defining hallfetica_normal at the beginning of the functions giving the error

I tried defining the function at the beginning of the .cpp file

Sorry if it does not look like I am making an effort but I actually had been trying to debug this for about 6 hours before I even posted anything. Any sort of suggestion would be greatly appreciated. If someone is willing to help me debug this, I would love it.

Also, here is the website for the open source project I am working off of. It works on the site - http://thegreenautomation.com/

PaulMurrayCbr:
Ok, dude, before asking us to fix your program line by line, how's about you make at least an attempt to understand what the error message means? How about you actually read it? You gotta look like you are making an effort, man. We are all happy to help someone learn, but if you simply want me to fix your problems for you then you'll have to pay me my usual rate.

I believe I figured it out - font.c has to be within the UTFT folder, which I didn't realize. Can someone confirm this for me because I'm now getting a different error but I don't know if it is because of something else or if it's because I put the font.c file into the UTFT folder.

I came upon this solution from here

http://forum.arduino.cc/index.php?topic=275903.0

Here's the new error I'm getting:

WinAlarms.cpp: In member function 'virtual void WinAlarms::print()':
WinAlarms.cpp:33: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]
_lcd->setFont(various_symbols);
^
In file included from Buttons.h:23:0,
from Window.h:20,
from WinAlarms.h:17,
from WinAlarms.cpp:1:
C:\Program Files (x86)\Arduino\libraries\UTFT/UTFT.h:187:8: error: initializing argument 1 of 'void UTFT::setFont(uint8_t*)' [-fpermissive]
void setFont(uint8_t* font);
^
invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t* {aka unsigned char*}' [-fpermissive]