- Forum
- General C++ Programming
- Error expected at the end of input../pri
Error expected at the end of input../primary expression
Hi, I am writing a program and ive recive these two errors all of a sudden saying Error expected at the end of input and error expected primary expression at at the end of input… Can anyone figure out the error?
Line error is on the last line
|
|
Last edited on
Didn’t you get a line number with the error message? Or does your system expect you to be a mindreader?
The error line is 243
..
Last edited on
my apologies the brace is in my program , i just missed it out here.. will enter it in now… but my errors still remains on the last line
I just had a quick look at your code using the shell and also what you presneted here.
You have a series of stuff ups with braces etc and you will need to:
1. Properly present your code professionally especially using proper indentation.
2. Line 241 is rubbish that does nothing. Get rid of it.
3. Make sure all braces balance.
You’re in for some fairly easy editing and debugging if you do that and if you understand the code you’re using.
Last edited on
Multiple poster pest — music just stopped from me.
http://www.cplusplus.com/forum/general/180016/
Last edited on
Topic archived. No new replies allowed.
Лизаветка 1 / 1 / 0 Регистрация: 01.05.2017 Сообщений: 34 |
||||
1 |
||||
01.05.2017, 21:41. Показов 35821. Ответов 13 Метки нет (Все метки)
Посмотрите, пожалуйста. Выдает ошибку expected ‘}’ at end of input, но скобки везде попарно
__________________
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 21:53 |
2 |
а на какой строке вылетает ошибка?
0 |
284 / 232 / 114 Регистрация: 07.09.2016 Сообщений: 584 |
|
01.05.2017, 21:57 |
3 |
привыкайте нормально код форматировать. черт ногу сломит в такой писанине.
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 21:59 |
4 |
Во-первых, если операция только одна, то операторные скобки необязательны (хотя бы не запутаетесь)
0 |
Лизаветка 1 / 1 / 0 Регистрация: 01.05.2017 Сообщений: 34 |
||||
01.05.2017, 22:07 [ТС] |
5 |
|||
вот полный код программы, выдает ошибку в последней строке, пробовала убирать частично код программы, ошибка уходит, если только убрать строки #include «teoria.h» и #include «teoria.cpp, выходит ошибка в них
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 22:11 |
6 |
#include «teoria.cpp» что значит #include исходный код C++? Вы подключаете и хедер teoria.h и исходник teoria.cpp
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 22:12 |
7 |
И учитесь уже обрамлять код тегами [CPP] Миниатюры
0 |
1 / 1 / 0 Регистрация: 01.05.2017 Сообщений: 34 |
|
01.05.2017, 22:15 [ТС] |
8 |
спасибо, впредь буду оформлять нормально, это мои первые 15 минут на данном форуме)
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 22:16 |
9 |
Лизаветка, ну а насчет инклюдов Вы поняли?
0 |
Лизаветка 1 / 1 / 0 Регистрация: 01.05.2017 Сообщений: 34 |
||||||||
01.05.2017, 22:20 [ТС] |
10 |
|||||||
нет. я подключаю и то и то, без хедера ошибка остается.
и вот teoria.h
Что нужно убрать?
0 |
Джоуи 1073 / 635 / 240 Регистрация: 05.05.2015 Сообщений: 3,546 Записей в блоге: 2 |
|
01.05.2017, 22:22 |
11 |
Лизаветка, вопрос остается прежним: на какой строке и в каком файле возникает ошибка? Можно скриншот скинуть, если сами не разбираетесь
0 |
DU3 284 / 232 / 114 Регистрация: 07.09.2016 Сообщений: 584 |
||||
01.05.2017, 22:24 |
12 |
|||
Сообщение было отмечено Лизаветка как решение Решение нормально форматируйте не только тут на форуме, но и у себя в редакторе и такого рода проблем будет на порядок меньше.
1 |
Joey |
01.05.2017, 22:29
|
Не по теме: DU3, ждем
0 |
1 / 1 / 0 Регистрация: 01.05.2017 Сообщений: 34 |
|
01.05.2017, 22:35 [ТС] |
14 |
Спасибо за ответы) ошибка выволилась на последней строке основной программы, оказалось нет закрывабщейся скобки в файле teoria.cpp , спасибо за вопросы, буду работать над оформлением��
1 |
IT_Exp Эксперт 87844 / 49110 / 22898 Регистрация: 17.06.2006 Сообщений: 92,604 |
01.05.2017, 22:35 |
Помогаю со студенческими работами здесь Ошибка: Expected END but received ELSE … Ошибка: ‘END’ expected but ‘ELSE’ found Ошибка: ‘END’ expected but ‘UNTIL’ found interface uses Ошибка ‘Expected END but recieved’ interface Искать еще темы с ответами Или воспользуйтесь поиском по форуму: 14 |
I get the following error when I compile:
convert.cpp: In function 'std::string convert()':
convert.cpp:62: error: expected primary-expression before 'else'
convert.cpp:62: error: expected `;' before 'else'
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error: expected `}' at end of input
convert.cpp:108: error: expected `}' at end of input
Code:
#include<iostream>
#include<stack>
#include<string>
using namespace std;
string infix; // infix expression string
string operand;
string operate;
stack <string> mystack; // this stack is used to push the operator
string postfix; // postfix string where the operand is appended
//....................................................................
// this function read the infix expression from user
string input()
{
cout<<" Enter the damn infix expression: "<<endl;
getline(cin, infix);
return infix;
}
//......................................................................
// this function checks for operator precedence in the stack
int precedence(string e)
{
int f;
if(e == "*" || e== "/" || e =="%")
f = 2;
else
{
if(e == "+" || e == "-")
f = 1;
}
if(e=="."){
f=0;
}
return f;
}
//....................................................................
// This function converts infix to postfix
string convert()
{
for(int i=0; i<infix.length(); i++)
{
switch(infix[i]){
// operate case start
case '+': case'-': case'*': case'/': case'^': case '(': case ')': case'.':
operate=infix[i];
{
if(mystack.empty() || precedence(operate)>= precedence(mystack.top()))
{
mystack.push(operate);
else
{
while(precedence(operate)<= precedence(mystack.top()))
{
postfix.append(mystack.top());
mystack.pop();
}
mystack.push(operate);
}
}
}//operate case closed
default: //when operand string char is parsed
{
operand=infix[i];
postfix.append(operand);
break;
} // default case closed
}//switch closed
}
while(!mystack.empty())
{
postfix.append(mystack.top())
mystack.pop();
}
return postfix;
cout<<postfix;
}
//...................................................................
int main()
{
input();
convert();
cout<<"postfix is "<<postfix<<endl;
}
SCFrench
8,2162 gold badges31 silver badges61 bronze badges
asked Oct 3, 2010 at 0:14
It appears that your code is just missing some closing braces. That’s all.
For example, look at this:
operate=infix[i];
{
if(mystack.empty() || precedence(operate)>= precedence(mystack.top()))
{
mystack.push(operate);
else
{
while(precedence(operate)<= precedence(mystack.top()))
Where is the closing } before the else statement. Just go through your code and fix these silly mistakes.
It would be a lot easier to rid yourself of these things if you made your spacing and indentation a little neater.
answered Oct 3, 2010 at 0:23
1
The «expected primary expression before else» diagnostic is the compiler-author’s way of reporting you rudely foisted on him an «else» without either a preceding «if» or (what amounts to the same thing) «else if». Alexander Rafferty correctly points out that this is because the code has …
if (condition) {
// ...
else { }
… when perhaps what you meant was …
if (condition) {
// ...
}
else {
}
… though maybe you deleted a whole bunch of stuff by accident, and were lucky enough that the deletion resulted in unparseable code, so you will realize that something is wrong.
answered Oct 3, 2010 at 0:48
Thomas L HoladayThomas L Holaday
13.5k6 gold badges40 silver badges51 bronze badges
Look at these lines:
if(mystack.empty() || precedence(operate)>= precedence(mystack.top()))
{
mystack.push(operate);
else
answered Oct 3, 2010 at 1:13
Martin YorkMartin York
253k84 gold badges332 silver badges555 bronze badges
0
Here’s the whole error:
Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"
*readMifarereadMifare.ino: In function 'void loop()':
readMifare:113: error: expected primary-expression before ']' token
if (uid[] == { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 }) {
^
readMifare:113: error: expected primary-expression before '{' token
if (uid[] == { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 }) {
^
readMifare:113: error: expected ')' before '{' token
readMifare:121: error: expected '}' at end of input
}
^
exit status 1
expected primary-expression before ']' token
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Here’s the code
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>
// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK (2)
#define PN532_MOSI (3)
#define PN532_SS (4)
#define PN532_MISO (5)
// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines. Use the values below (2, 3) for the shield!
#define PN532_IRQ (2)
#define PN532_RESET (3) // Not connected by default on the NFC Shield
// Uncomment just _one_ line below depending on how your breakout or shield
// is connected to the Arduino:
// Use this line for a breakout with a software SPI connection (recommended):
Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);
// Use this line for a breakout with a hardware SPI connection. Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins. On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12. The SS line can be any digital IO pin.
//Adafruit_PN532 nfc(PN532_SS);
// Or use this line for a breakout or shield with an I2C connection:
//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);
#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
// also change #define in Adafruit_PN532.cpp library file
#define Serial SerialUSB
#endif
#include <Servo.h>
Servo servo1;
void setup(void) {
#ifndef ESP8266
while (!Serial); // for Leonardo/Micro/Zero
#endif
Serial.begin(115200);
Serial.println("Hello!");
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (! versiondata) {
Serial.print("Didn't find PN53x board");
while (1); // halt
}
// Got ok data, print it out!
Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
// configure board to read RFID tags
nfc.SAMConfig();
Serial.println("Waiting for an ISO14443A Card ...");
servo1.attach(9);
}
void loop(void) {
uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 }; // Buffer to store the returned UID
uint8_t uidLength; // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
// Wait for an ISO14443A type cards (Mifare, etc.). When one is found
// 'uid' will be populated with the UID, and uidLength will indicate
// if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (uid[] = { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 }) {
int position;
for(position = 0; position < 180; position += 2){
servo1.write(position);
delay(20);
}
}
Please note that I’m using an example from the Adafruit official PN532 library examples and trying to edit it.
I’m having the same problem even with GCC 4.8
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~14.04.3' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
Command gcc -v exited successfully with status 0.
Took 0.00512 seconds.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/go/.bundled-gems/gems/sassc-1.10.1/ext
/opt/local/rbenv/versions/2.3.0/bin/ruby -rubygems
/var/go/.bundled-gems/gems/rake-11.3.0/exe/rake
RUBYARCHDIR=/var/go/.bundled-gems/extensions/x86_64-linux/2.3.0-static/sassc-1.10.1
RUBYLIBDIR=/var/go/.bundled-gems/extensions/x86_64-linux/2.3.0-static/sassc-1.10.1
cd libsass
make lib/libsass.so
mkdir lib
cc -Wall -O2 -I /var/go/.bundled-gems/gems/sassc-1.10.1/ext/libsass/include
-fPIC -fPIC -c -o src/cencode.o src/cencode.c
g++ -Wall -O2 -std=c++0x -I
/var/go/.bundled-gems/gems/sassc-1.10.1/ext/libsass/include -fPIC -fPIC -c -o
src/ast.o src/ast.cpp
In file included from src/ast.cpp:2:
src/ast.hpp: In member function ‘virtual size_t Sass::Vectorized<T>::hash()’:
src/ast.hpp:257: error: expected initializer before ‘:’ token
src/ast.hpp:260: error: expected primary-expression before ‘}’ token
src/ast.hpp:260: error: expected ‘;’ before ‘}’ token
src/ast.hpp:260: error: expected primary-expression before ‘}’ token
src/ast.hpp:260: error: expected ‘)’ before ‘}’ token
src/ast.hpp:260: error: expected primary-expression before ‘}’ token
src/ast.hpp:260: error: expected ‘;’ before ‘}’ token
src/ast.hpp: In constructor ‘Sass::Hashed::Hashed(size_t)’:
src/ast.hpp:307: error: ‘class std::unordered_map<Sass::Expression*,
Sass::Expression*, Sass::Hashed::HashExpression,
Sass::Hashed::CompareExpression, std::allocator<std::pair<Sass::Expression*
const, Sass::Expression*> > >’ has no member named ‘reserve’
src/ast.hpp: In member function ‘Sass::Hashed&
Sass::Hashed::operator+=(Sass::Hashed*)’:
src/ast.hpp:336: error: expected initializer before ‘:’ token
src/ast.hpp:340: error: could not convert ‘Sass::Hashed::reset_duplicate_key()’
to ‘bool’
src/ast.hpp:341: error: expected primary-expression before ‘return’
src/ast.hpp:341: error: expected ‘)’ before ‘return’
src/ast.hpp: In member function ‘virtual size_t Sass::Map::hash()’:
src/ast.hpp:936: error: expected initializer before ‘:’ token
src/ast.hpp:940: error: expected primary-expression before ‘}’ token
src/ast.hpp:940: error: expected ‘;’ before ‘}’ token
src/ast.hpp:940: error: expected primary-expression before ‘}’ token
src/ast.hpp:940: error: expected ‘)’ before ‘}’ token
src/ast.hpp:940: error: expected primary-expression before ‘}’ token
src/ast.hpp:940: error: expected ‘;’ before ‘}’ token
src/ast.hpp: In member function ‘virtual size_t Sass::Function_Call::hash()’:
src/ast.hpp:1232: error: expected initializer before ‘:’ token
src/ast.hpp:1234: error: expected primary-expression before ‘}’ token
src/ast.hpp:1234: error: expected ‘;’ before ‘}’ token
src/ast.hpp:1234: error: expected primary-expression before ‘}’ token
src/ast.hpp:1234: error: expected ‘)’ before ‘}’ token
src/ast.hpp:1234: error: expected primary-expression before ‘}’ token
src/ast.hpp:1234: error: expected ‘;’ before ‘}’ token
src/ast.hpp: In member function ‘virtual size_t Sass::Number::hash()’:
src/ast.hpp:1361: error: expected initializer before ‘:’ token
src/ast.hpp:1363: error: expected primary-expression before ‘for’
src/ast.hpp:1363: error: expected ‘;’ before ‘for’
src/ast.hpp:1363: error: expected primary-expression before ‘for’
src/ast.hpp:1363: error: expected ‘)’ before ‘for’
src/ast.hpp:1363: error: expected initializer before ‘:’ token
src/ast.hpp:1365: error: expected primary-expression before ‘}’ token
src/ast.hpp:1365: error: expected ‘;’ before ‘}’ token
src/ast.hpp:1365: error: expected primary-expression before ‘}’ token
src/ast.hpp:1365: error: expected ‘)’ before ‘}’ token
src/ast.hpp:1365: error: expected primary-expression before ‘}’ token
src/ast.hpp:1365: error: expected ‘;’ before ‘}’ token
src/ast.hpp: In member function ‘bool Sass::String_Schema::has_interpolants()’:
src/ast.hpp:1502: error: expected initializer before ‘:’ token
src/ast.hpp:1505: error: expected primary-expression before ‘return’
src/ast.hpp:1505: error: expected ‘;’ before ‘return’
src/ast.hpp:1505: error: expected primary-expression before ‘return’
src/ast.hpp:1505: error: expected ‘)’ before ‘return’
src/ast.hpp: In member function ‘virtual size_t Sass::String_Schema::hash()’:
src/ast.hpp:1514: error: expected initializer before ‘:’ token
src/ast.hpp:1516: error: expected primary-expression before ‘}’ token
src/ast.hpp:1516: error: expected ‘;’ before ‘}’ token
src/ast.hpp:1516: error: expected primary-expression before ‘}’ token
src/ast.hpp:1516: error: expected ‘)’ before ‘}’ token
src/ast.hpp:1516: error: expected primary-expression before ‘}’ token
src/ast.hpp:1516: error: expected ‘;’ before ‘}’ token
In file included from src/ast.cpp:2:
src/ast.hpp: In member function ‘virtual size_t
Sass::Compound_Selector::hash()’:
src/ast.hpp:2261: error: ‘template<class T> class Sass::Vectorized’ used without
template parameters
src/ast.hpp: In member function ‘virtual size_t Sass::Selector_List::hash()’:
src/ast.hpp:2488: error: ‘template<class T> class Sass::Vectorized’ used without
template parameters
src/ast.hpp: In member function ‘virtual void
Sass::Selector_List::set_media_block(Sass::Media_Block*)’:
src/ast.hpp:2505: error: expected initializer before ‘:’ token
src/ast.hpp:2508: error: expected primary-expression before ‘}’ token
src/ast.hpp:2508: error: expected ‘;’ before ‘}’ token
src/ast.hpp:2508: error: expected primary-expression before ‘}’ token
src/ast.hpp:2508: error: expected ‘)’ before ‘}’ token
src/ast.hpp:2508: error: expected primary-expression before ‘}’ token
src/ast.hpp:2508: error: expected ‘;’ before ‘}’ token
src/ast.cpp: In function ‘std::string& Sass::str_ltrim(std::string&)’:
src/ast.cpp:33: error: expected primary-expression before ‘[’ token
src/ast.cpp:33: error: expected primary-expression before ‘]’ token
src/ast.cpp:33: error: expected primary-expression before ‘char’
src/ast.cpp:33: error: unable to deduce ‘auto’ from ‘<expression error>’
src/ast.cpp: In function ‘std::string& Sass::str_rtrim(std::string&)’:
src/ast.cpp:40: error: expected primary-expression before ‘[’ token
src/ast.cpp:40: error: expected primary-expression before ‘]’ token
src/ast.cpp:40: error: expected primary-expression before ‘char’
src/ast.cpp:40: error: unable to deduce ‘auto’ from ‘<expression error>’
src/ast.cpp: In member function ‘virtual bool
Sass::Compound_Selector::has_parent_ref()’:
src/ast.cpp:139: error: expected initializer before ‘:’ token
src/ast.cpp:142: error: expected primary-expression before ‘return’
src/ast.cpp:142: error: expected ‘;’ before ‘return’
src/ast.cpp:142: error: expected primary-expression before ‘return’
src/ast.cpp:142: error: expected ‘)’ before ‘return’
src/ast.cpp: In member function ‘virtual bool
Sass::Compound_Selector::is_superselector_of(Sass::Selector_List*,
std::string)’:
src/ast.cpp:661: error: expected initializer before ‘:’ token
src/ast.cpp:664: error: expected primary-expression before ‘return’
src/ast.cpp:664: error: expected ‘;’ before ‘return’
src/ast.cpp:664: error: expected primary-expression before ‘return’
src/ast.cpp:664: error: expected ‘)’ before ‘return’
src/ast.cpp: In member function ‘Sass::Selector_List*
Sass::Complex_Selector::parentize(Sass::Selector_List*, Sass::Context&)’:
src/ast.cpp:1171: error: expected initializer before ‘:’ token
src/ast.cpp:2216: error: expected primary-expression at end of input
src/ast.cpp:2216: error: expected ‘;’ at end of input
src/ast.cpp:2216: error: expected primary-expression at end of input
src/ast.cpp:2216: error: expected ‘)’ at end of input
src/ast.cpp:2216: error: expected statement at end of input
src/ast.cpp:2216: error: expected ‘}’ at end of input
src/ast.cpp:2216: error: expected ‘}’ at end of input
src/ast.cpp: At global scope:
src/ast.cpp:2216: error: expected ‘}’ at end of input
src/units.hpp:10: warning: ‘Sass::PI’ defined but not used
make: *** [src/ast.o] Error 1
rake aborted!
Command failed with status (2): [make lib/libsass.so...]
/var/go/.bundled-gems/gems/sassc-1.10.1/lib/tasks/libsass.rb:29:in `block (2
levels) in <top (required)>'
/var/go/.bundled-gems/gems/sassc-1.10.1/lib/tasks/libsass.rb:11:in `block (3
levels) in <top (required)>'
/var/go/.bundled-gems/gems/sassc-1.10.1/lib/tasks/libsass.rb:10:in `block (2
levels) in <top (required)>'
/var/go/.bundled-gems/gems/rake-11.3.0/exe/rake:27:in `<main>'
Tasks: TOP => lib/libsass.so
(See full trace by running task with --trace)
rake failed, exit code 1
Gem files will remain installed in /var/go/.bundled-gems/gems/sassc-1.10.1 for
inspection.
Results logged to
/var/go/.bundled-gems/extensions/x86_64-linux/2.3.0-static/sassc-1.10.1/gem_make.out
An error occurred while installing sassc (1.10.1), and Bundler cannot continue.
^
zc_functionobjects.cpp(32): warning #12: parsing restarts here after previous syntax error
}lambda3;
^
zc_functionobjects.cpp(34): error #77: this declaration has no storage class ortype specifier
lambda3(lam);
^
zc_functionobjects.cpp(34): error: identifier «lam» is undefined
lambda3(lam);
^
zc_functionobjects.cpp(41): error: identifier «LAMBDA» is undefined
LAMBDA val;
^
zc_functionobjects.cpp(43): error: identifier «LAMBDA» is undefined
Lambda1(LAMBDA l) : val(l)
^
zc_functionobjects.cpp(54): error #303: explicit type is missing («int» assumed)
lambda4();
^
zc_functionobjects.cpp(54): error: declaration is incompatible with «Lambda1 lambda4» (declared at line 52)
lambda4();
^
zc_functionobjects.cpp(57): error: identifier «Dummy» is undefined
void (*p)(void) = &Dummy;
^
zc_functionobjects.cpp(96): error: function returning function is not allowed
lambda5()();
^
zc_functionobjects.cpp(96): error: declaration is incompatible with «Lambda2 lambda5» (declared at line 94)
lambda5()();
^
zc_functionobjects.cpp(104): error: identifier «LAMBDA» is undefined
LAMBDA lambda;
^
zc_functionobjects.cpp(110): error: identifier «LAMBDA» is undefined
LAMBDA lambda;
^
zc_functionobjects.cpp(114): error: identifier «LAMBDA» is undefined
InnerLambda(LAMBDA l) : lambda(l)
^
zc_functionobjects.cpp(127): error: identifier «LAMBDA» is undefined
Lambda3(LAMBDA l) : lambda(l), innerLambda(lambda)
^
zc_functionobjects.cpp(148): error: identifier «LAMBDA» is undefined
LAMBDA lambda;
^
zc_functionobjects.cpp(152): error: identifier «LAMBDA» is undefined
InnerLambda(LAMBDA l) : lambda(l)
^
zc_functionobjects.cpp(165): error: identifier «LAMBDA» is undefined
InnerLambda operator () (LAMBDA l)
^
zc_functionobjects.cpp(171): error #77: this declaration has no storage class or type specifier
lambda7(lam);
^
zc_functionobjects.cpp(171): error: variable «lambda7» has already been defined
lambda7(lam);
^
zc_functionobjects.cpp(174): error #77: this declaration has no storage class or type specifier
result(lam);
^
zc_functionobjects.cpp(175): error: expected a declaration
}
^
zc_functionobjects.cpp(195): warning #12: parsing restarts here after previous syntax error
compilation aborted for zc_functionobjects.cpp (code 2)
-
Я новичок написал вот такой скетч ( со строки {int Hours_62193421_1; компиляция c flprog)
#include <TM1637.h>const int butSPin = 2;
int butSState = 0;
void setup() {
pinMode (butSPin , INPUT);}
int flag=0;
void loop(){
if(digitalRead(butSState)==HIGH&&flag==0){int Hours_62193421_1;
int Mins_62193421_1;
bool Sec_62193421_1;
int Brightness_62193421_1;
TM1637 tm1637_62193421_1(7 , 8);
int8_t TimeDisp_62193421_1[] = {0x00,0x00,0x00,0x00};
int _gtv1;
int _gtv2;
bool _gtv4;
int _gtv5;
bool _gtv6;
bool _gtv7;
bool _gtv8;
bool _gtv9;
bool _trgrt6 = 0;
bool _trgrt6I = 0;
bool _trgrt5 = 0;
bool _trgrt5I = 0;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
bool _bounseInputD4S = 0;
bool _bounseInputD4O = 0;
unsigned long _bounseInputD4P = 0UL;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _changeNumber1_Out = 0;
int _changeNumber1_OLV;
bool _trgrt4 = 0;
bool _trgrt4I = 0;
bool _trgs1 = 0;
bool _trgrt3 = 0;
bool _trgrt3I = 0;
bool _trgrt1 = 0;
bool _trgrt1I = 0;
bool _count1I = 0;
int _count1P = 0;
bool _trgrt2 = 0;
bool _trgrt2I = 0;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
bool _trgt1 = 0;
bool _trgt1I = 0;
void setup()
{
pinMode(4, INPUT);
digitalWrite(4, HIGH);
pinMode(9, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(13, OUTPUT);_bounseInputD4O = digitalRead(4);
tm1637_62193421_1.set();
tm1637_62193421_1.init();
}
void loop()
{int _tempVariable_int;// здесь ошибка ============================================bool _bounceInputTmpD4 = (digitalRead (4));
if (_bounseInputD4S)
{
if (millis() >= (_bounseInputD4P + 40))
{_bounseInputD4O= _bounceInputTmpD4; _bounseInputD4S=0;}
}
else
{
if (_bounceInputTmpD4 != _bounseInputD4O )
{_bounseInputD4S=1; _bounseInputD4P = millis();}
}//Плата:1
if (!(_bounseInputD4O)) { if (_trgrt5I) { _trgrt5 = 0;} else {_trgrt5 = 1; _trgrt5I = 1;} } else {_trgrt5 = 0; _trgrt5I = 0;};
bool _tmp1 = ( (_trgrt5) || (( (_gtv6) && (_gtv7) )) );
if (_tmp1) { if (! _trgt1I) _trgt1 = ! _trgt1; }
_trgt1I = _tmp1;
_gtv6 = _trgt1;
digitalWrite(6, !(_gtv6));
digitalWrite(5, _gtv6);
digitalWrite(13, ( (_gtv6) && (_gtv4) ));
if (_gtv6) { if (! _gen2I) { _gen2I = 1; _gen2O = 1; _gen2P = millis(); } } else { _gen2I = 0 ; _gen2O= 0;}
if (_gen2I) { if ( _isTimer ( _gen2P , 30000 )) { _gen2P = millis(); _gen2O = ! _gen2O;}}
_gtv8 = _gen2O;//Плата:2
if (!(0)) { if (! _gen1I) { _gen1I = 1; _gen1O = 1; _gen1P = millis(); } } else { _gen1I = 0 ; _gen1O= 0;}
if (_gen1I) { if ( _isTimer ( _gen1P , 500 )) { _gen1P = millis(); _gen1O = ! _gen1O;}}
_gtv4 = _gen1O;
if (_gen1O) { if (_trgrt1I) { _trgrt1 = 0;} else {_trgrt1 = 1; _trgrt1I = 1;} } else {_trgrt1 = 0; _trgrt1I = 0;};
if (_trgrt1) {
_gtv5 = (map(( (analogRead (0))), (0), (1023), (0), (300)));
}
if (_changeNumber1_Out) {_changeNumber1_Out = 0;} else {_tempVariable_int = _gtv5;
if (_tempVariable_int != _changeNumber1_OLV) {_changeNumber1_OLV = _tempVariable_int; _changeNumber1_Out = 1;}
}
if (!(0)) { if (_trgrt2I) { _trgrt2 = 0;} else {_trgrt2 = 1; _trgrt2I = 1;} } else {_trgrt2 = 0; _trgrt2I = 0;};
if (_gtv7) { if (_trgrt3I) { _trgrt3 = 0;} else {_trgrt3 = 1; _trgrt3I = 1;} } else {_trgrt3 = 0; _trgrt3I = 0;};
if(( (( (!(_gtv6)) && (_changeNumber1_Out) )) || (_trgrt2) || (_trgrt3) )) _count1P = (_gtv5);
if (( (!((_gtv5) < (1))) && (_gtv8) ))
{
if (! _count1I)
{
_count1P = _count1P—1;
_count1I = 1;
}
}
else
{
_count1I=0;
}
if ((_count1P) < (1)) { if (_trgrt4I) { _trgrt4 = 0;} else {_trgrt4 = 1; _trgrt4I = 1;} } else {_trgrt4 = 0; _trgrt4I = 0;};
_gtv7 = _trgrt4;
_gtv1 = _count1P;//Плата:3
//Наименование:Дисплей
_gtv2 = ((_gtv1)/(60))*(60);
Hours_62193421_1 = (_gtv1)/(60);
Mins_62193421_1 = (_gtv1)—(_gtv2);
Sec_62193421_1 = ( (_gtv4) && (_gtv6) );
Brightness_62193421_1 = 5;
TimeDisp_62193421_1[0] = Hours_62193421_1 / 10;
TimeDisp_62193421_1[1] = Hours_62193421_1 % 10;
TimeDisp_62193421_1[2] = Mins_62193421_1 / 10;
TimeDisp_62193421_1[3] = Mins_62193421_1 % 10;
if ( Sec_62193421_1 ) tm1637_62193421_1.point(HIGH); else tm1637_62193421_1.point(LOW);
tm1637_62193421_1.set(Brightness_62193421_1);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
tm1637_62193421_1.display(TimeDisp_62193421_1);//Плата:4
if(_gtv6) _trgs1 = 1;
if(_gtv9) _trgs1 = 0;
if (( (_trgs1) && (_gtv7) )) { if (_trgrt6I) { _trgrt6 = 0;} else {_trgrt6 = 1; _trgrt6I = 1;} } else {_trgrt6 = 0; _trgrt6I = 0;};
_gtv9 = _trgrt6;
if(_trgrt6) {_tim1O = 1; _tim1I = 1;} else { if(_tim1I) {_tim1I = 0; _tim1P = millis();} else { if (_tim1O) {if ( _isTimer(_tim1P, 5000)) _tim1O = 0;}}}
digitalWrite(9, ( (_gtv4) && (_tim1O) ));}
bool _isTimer(unsigned long startTime, unsigned long period )
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime) {return (currentTime>=(startTime + period));} else {return (currentTime >=(4294967295—startTime+period));}
}flag = 0
}if(digitalRead(butSState)==LOW&&flag==1)
flag=0;
}
}
выдаёт ошибку
Arduino: 1.8.5 (Windows 7), Плата:»Arduino Nano, ATmega328P»C:UsersТатьянаDocumentsArduinosketch_mar22asketch_mar22a.ino: In function ‘void loop()’:
sketch_mar22a:63: error: a function-definition is not allowed here before ‘{‘ token
sketch_mar22a:76: error: a function-definition is not allowed here before ‘{‘ token
sketch_mar22a:184: error: expected ‘}’ at end of input
sketch_mar22a:184: error: expected ‘}’ at end of input
exit status 1
a function-definition is not allowed here before ‘{‘ tokenЭтот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
«Показать подробный вывод во время компиляции»заранее спасибо!!!
Последнее редактирование: 23 мар 2018
-
Дважды
void loop объявлена
И внутри первой loop торчит объявление void setup.Разберите внимательно всю эту кашу. И читайте что говорит компилятор.
-
Убрать лишнее объявление
void loop().
И не повторять эту ошибку. -
После функции
bool _isTimer(unsigned long startTime, unsigned long period )
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime)
{
return (currentTime>=(startTime + period));
} else
{
return (currentTime >=(4294967295—startTime+period));
}
}
Идёт ещё какой то код.
Такое ощущение что ты втыкал куски кода куда попало.
-
а тут что ??????
#include <TM1637.h>
int Hours_62193421_1;
int Mins_62193421_1;
bool Sec_62193421_1;
int Brightness_62193421_1;
TM1637 tm1637_62193421_1(7 , 8);
int8_t TimeDisp_62193421_1[] = {0x00,0x00,0x00,0x00};
int _gtv1;
int _gtv2;
bool _gtv4;
int _gtv5;
bool _gtv6;
bool _gtv7;
bool _gtv8;
bool _gtv9;
bool _trgrt6 = 0;
bool _trgrt6I = 0;
bool _trgrt5 = 0;
bool _trgrt5I = 0;
bool _tim1I = 0;
bool _tim1O = 0;
unsigned long _tim1P = 0UL;
bool _bounseInputD4S = 0;
bool _bounseInputD4O = 0;
unsigned long _bounseInputD4P = 0UL;
bool _gen1I = 0;
bool _gen1O = 0;
unsigned long _gen1P = 0UL;
bool _changeNumber1_Out = 0;
int _changeNumber1_OLV;
bool _trgrt4 = 0;
bool _trgrt4I = 0;
bool _trgs1 = 0;
bool _trgrt3 = 0;
bool _trgrt3I = 0;
bool _trgrt1 = 0;
bool _trgrt1I = 0;
bool _count1I = 0;
int _count1P = 0;
bool _trgrt2 = 0;
bool _trgrt2I = 0;
bool _gen2I = 0;
bool _gen2O = 0;
unsigned long _gen2P = 0UL;
bool _trgt1 = 0;
bool _trgt1I = 0;
const int butSPin = 2;
int butSState = 0;
void setup()
{
pinMode(4, INPUT);
digitalWrite(4, HIGH);
pinMode(9, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(13, OUTPUT);_bounseInputD4O = digitalRead(4);
tm1637_62193421_1.set();
tm1637_62193421_1.init();
pinMode (butSPin , INPUT);}
int flag=0;
void loop(){
if(digitalRead(butSState)==HIGH&&flag==0)
{int _tempVariable_int;
bool _bounceInputTmpD4 = (digitalRead (4));
if (_bounseInputD4S)
{
if (millis() >= (_bounseInputD4P + 40))
{_bounseInputD4O= _bounceInputTmpD4; _bounseInputD4S=0;}
}
else
{
if (_bounceInputTmpD4 != _bounseInputD4O )
{_bounseInputD4S=1; _bounseInputD4P = millis();}
}//Плата:1
if (!(_bounseInputD4O)) { if (_trgrt5I) { _trgrt5 = 0;} else {_trgrt5 = 1; _trgrt5I = 1;} } else {_trgrt5 = 0; _trgrt5I = 0;};
bool _tmp1 = ( (_trgrt5) || (( (_gtv6) && (_gtv7) )) );
if (_tmp1) { if (! _trgt1I) _trgt1 = ! _trgt1; }
_trgt1I = _tmp1;
_gtv6 = _trgt1;
digitalWrite(6, !(_gtv6));
digitalWrite(5, _gtv6);
digitalWrite(13, ( (_gtv6) && (_gtv4) ));
if (_gtv6) { if (! _gen2I) { _gen2I = 1; _gen2O = 1; _gen2P = millis(); } } else { _gen2I = 0 ; _gen2O= 0;}
if (_gen2I) { if ( _isTimer ( _gen2P , 30000 )) { _gen2P = millis(); _gen2O = ! _gen2O;}}
_gtv8 = _gen2O;//Плата:2
if (!(0)) { if (! _gen1I) { _gen1I = 1; _gen1O = 1; _gen1P = millis(); } } else { _gen1I = 0 ; _gen1O= 0;}
if (_gen1I) { if ( _isTimer ( _gen1P , 500 )) { _gen1P = millis(); _gen1O = ! _gen1O;}}
_gtv4 = _gen1O;
if (_gen1O) { if (_trgrt1I) { _trgrt1 = 0;} else {_trgrt1 = 1; _trgrt1I = 1;} } else {_trgrt1 = 0; _trgrt1I = 0;};
if (_trgrt1) {
_gtv5 = (map(( (analogRead (0))), (0), (1023), (0), (300)));
}
if (_changeNumber1_Out) {_changeNumber1_Out = 0;} else {_tempVariable_int = _gtv5;
if (_tempVariable_int != _changeNumber1_OLV) {_changeNumber1_OLV = _tempVariable_int; _changeNumber1_Out = 1;}
}
if (!(0)) { if (_trgrt2I) { _trgrt2 = 0;} else {_trgrt2 = 1; _trgrt2I = 1;} } else {_trgrt2 = 0; _trgrt2I = 0;};
if (_gtv7) { if (_trgrt3I) { _trgrt3 = 0;} else {_trgrt3 = 1; _trgrt3I = 1;} } else {_trgrt3 = 0; _trgrt3I = 0;};
if(( (( (!(_gtv6)) && (_changeNumber1_Out) )) || (_trgrt2) || (_trgrt3) )) _count1P = (_gtv5);
if (( (!((_gtv5) < (1))) && (_gtv8) ))
{
if (! _count1I)
{
_count1P = _count1P—1;
_count1I = 1;
}
}
else
{
_count1I=0;
}
if ((_count1P) < (1)) { if (_trgrt4I) { _trgrt4 = 0;} else {_trgrt4 = 1; _trgrt4I = 1;} } else {_trgrt4 = 0; _trgrt4I = 0;};
_gtv7 = _trgrt4;
_gtv1 = _count1P;//Плата:3
//Наименование:Дисплей
_gtv2 = ((_gtv1)/(60))*(60);
Hours_62193421_1 = (_gtv1)/(60);
Mins_62193421_1 = (_gtv1)—(_gtv2);
Sec_62193421_1 = ( (_gtv4) && (_gtv6) );
Brightness_62193421_1 = 5;
TimeDisp_62193421_1[0] = Hours_62193421_1 / 10;
TimeDisp_62193421_1[1] = Hours_62193421_1 % 10;
TimeDisp_62193421_1[2] = Mins_62193421_1 / 10;
TimeDisp_62193421_1[3] = Mins_62193421_1 % 10;
if ( Sec_62193421_1 ) tm1637_62193421_1.point(HIGH); else tm1637_62193421_1.point(LOW);
tm1637_62193421_1.set(Brightness_62193421_1);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
tm1637_62193421_1.display(TimeDisp_62193421_1);//Плата:4
if(_gtv6) _trgs1 = 1;
if(_gtv9) _trgs1 = 0;
if (( (_trgs1) && (_gtv7) )) { if (_trgrt6I) { _trgrt6 = 0;} else {_trgrt6 = 1; _trgrt6I = 1;} } else {_trgrt6 = 0; _trgrt6I = 0;};
_gtv9 = _trgrt6;
if(_trgrt6) {_tim1O = 1; _tim1I = 1;} else { if(_tim1I) {_tim1I = 0; _tim1P = millis();} else { if (_tim1O) {if ( _isTimer(_tim1P, 5000)) _tim1O = 0;}}}
// here erorr выше строка//===============================================
digitalWrite(9, ( (_gtv4) && (_tim1O) ));}
bool _isTimer(unsigned long startTime, unsigned long period )
{
unsigned long currentTime;
currentTime = millis();
if (currentTime>= startTime) {return (currentTime>=(startTime + period));} else {return (currentTime >=(4294967295—startTime+period));}
}flag = 0
}if(digitalRead(butSState)==LOW&&flag==1)
flag=0;
}
}
вот ошибка
Arduino: 1.8.5 (Windows 7), Плата:»Arduino Nano, ATmega328P»C:UsersТатьянаDocumentsArduinosketch_mar22asketch_mar22a.ino: In function ‘void loop()’:
sketch_mar22a:100: error: ‘_isTimer’ was not declared in this scope
sketch_mar22a:105: error: ‘_isTimer’ was not declared in this scope
sketch_mar22a:154: error: ‘_isTimer’ was not declared in this scope
sketch_mar22a:162: error: a function-definition is not allowed here before ‘{‘ token
sketch_mar22a:180: error: expected ‘}’ at end of input
exit status 1
‘_isTimer’ was not declared in this scopeЭтот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
«Показать подробный вывод во время компиляции» -
Всё написано в сообщениях об ошибке
: ‘_isTimer’ was not declared in this scope
Функции и переменные нужно объявлять до их использования, а не где попало.
-
В строке 162 какая то функция объявлена неожиданно
sketch_mar22a:162: error: a function-definition is not allowed here before ‘{‘
-
И вероятно фигурные скобки не сбалансированы. Где то не хватает закрывающей скобки.
Понять это можно когда файл с программой весь прочитан, а скобки так и нет.
sketch_mar22a:180: error: expected ‘}’ at end of input
-
наконец то
компиляция завершена
скетч использует 4360 байт -
было ооочень много ошибок
-
что поделаешь мне всего 12 лет
-
Чаще скетч проверяй компилятором по ходу написания.
Поменял строчку. Проверил. Так гораздо проще ошибку найти. -
eg12
В этом фрагменте кода:currentTime = millis();
if (currentTime>= startTime)
{значение startTime может находится в будущем? Иначе проверка не имеет смысла.
Для общего развития, советую ознакомиться.
The expected primary expression before occurs due to syntax errors. It usually has a character or a keyword at the end that clarifies the cause. Here you’ll get access to the most common syntax mistakes that throw the same error.
Continue reading to see where you might be getting wrong and how you can solve the issue.
Contents
- Why Does the Expected Primary Expression Before Occur?
- – You Are Specifying the Data Type With Function Argument
- – The Wrong Type of Arguments
- – Issue With the Curly Braces Resulting in Expected Primary Expression Before }
- – The Parenthesis Following the If Statement Don’t Contain an Expression
- How To Fix the Given Error?
- – Remove the Data Type That Precedes the Function Argument
- – Pass the Arguments of the Expected Data Type
- – Ensure The Equal Number of Opening and Closing Curly Brackets
- – Add an Expression in the If Statement Parenthesis
- FAQ
- – What Does It Mean When the Error Says “Expected Primary Expression Before Int” in C?
- – What Is a Primary Expression in C Language?
- – What Are the Types of Expressions?
- Conclusion
Why Does the Expected Primary Expression Before Occur?
The expected primary expression before error occurs when your code doesn’t follow the correct syntax. The mistakes pointed out below are the ones that often take place when you are new to programming. However, a programmer in hurry might make the same mistakes.
So, here you go:
– You Are Specifying the Data Type With Function Argument
If your function call contains the data type along with the argument, then you’ll get an error.
Here is the problematic function call:
int addFunction(int num1, int num2)
{
int sum;
sum = num1 + num2;
return sum;
}
int main()
{
int result = addFunction(int 20, int 30);
}
– The Wrong Type of Arguments
Passing the wrong types of arguments can result in the same error. You can not pass a string to a function that accepts an argument of int data type.
int main()
{
int result = addFunction(string “cat”, string “kitten”);
}
– Issue With the Curly Braces Resulting in Expected Primary Expression Before }
Missing a curly bracket or adding an extra curly bracket usually results in the mentioned error.
– The Parenthesis Following the If Statement Don’t Contain an Expression
If the parenthesis in front of the if statement doesn’t contain an expression or the result of an expression, then the code won’t run properly. Consequently, you’ll get the stated error.
How To Fix the Given Error?
You can fix the “expected primary-expression before” error by using the solutions given below:
– Remove the Data Type That Precedes the Function Argument
Remove the data type from the parenthesis while calling a function to solve the error. Here is the correct way to call a function:
int main()
{
int result = addFunction(30, 90);
}
– Pass the Arguments of the Expected Data Type
Double-check the function definition and pass the arguments of the type that matches the data type of the parameters. It will ensure that you pass the correct arguments and kick away the error.
– Ensure The Equal Number of Opening and Closing Curly Brackets
Your program must contain an equal number of opening and closing curly brackets. Begin with carefully observing your code to see where you are doing the mistake.
– Add an Expression in the If Statement Parenthesis
The data inside the parenthesis following the if statement should be either an expression or the result of an expression. Even adding either true or false will solve the issue and eliminate the error.
FAQ
You can view latest topics and suggested topics that’ll help you as a new programmer.
– What Does It Mean When the Error Says “Expected Primary Expression Before Int” in C?
The “expected primary expression before int” error means that you are trying to declare a variable of int data type in the wrong location. It mostly happens when you forget to terminate the previous statement and proceed with declaring another variable.
– What Is a Primary Expression in C Language?
A primary expression is the basic element of a complex expression. The identifiers, literals, constants, names, etc are considered primary expressions in the C programming language.
– What Are the Types of Expressions?
The different types of expressions include arithmetic, character, and logical or relational expressions. An arithmetic expression returns an arithmetic value. A character expression gives back a character value. Similarly, a logical value will be the output of a logical or relational expression.
Conclusion
The above error revolves around syntax mistakes and can be solved easily with a little code investigation. The noteworthy points depicting the solutions have been written below to help you out in removing the error:
- Never mention the data type of parameters while calling a function
- Ensure that you pass the correct type of arguments to the given function
- You should not miss a curly bracket or add an extra one
- The if statement should always be used with the expressions, expression results, true, or false
The more you learn the syntax and practice coding, the more easily you’ll be able to solve the error.
- Author
- Recent Posts
Position Is Everything: Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL.