I’m currently writing a C++ application which implements an Oscillator in conjuction with math.h. The code I have should work fine for the application (trying to compile an object file), bu I’m getting a compiler error most likely having to do with syntax/etc; I think it has something to do with namespace. The error:
Terminal Output:
User-Name-Macbook-Pro:Synth Parts UserName$ make
g++ -o Oscillators.o -c -I. Oscillators.cpp -c
In file included from Oscillators.cpp:2:
/usr/include/math.h:41: error: expected unqualified-id before string constant
In file included from /usr/include/c++/4.2.1/bits/locale_facets.tcc:42,
from /usr/include/c++/4.2.1/locale:46,
from /usr/include/c++/4.2.1/bits/ostream.tcc:46,
from /usr/include/c++/4.2.1/ostream:635,
from /usr/include/c++/4.2.1/iostream:45,
from Oscillators.cpp:4:
/usr/include/c++/4.2.1/typeinfo:41: error: expected declaration before end of line
make: *** [Oscillators.o] Error 1
Oscillators.cpp
#include "Oscillators.h"
#include <math.h>
#include <vector>
#include <iostream>
#define TWOPI (6.2831853072)
using namespace std;
oscillator(int srate = 44100, int tabsize = 8192, double freq = 200) // Default to output 200Hz Sine Wave
{
if(srate <= 0) {
cout << "Error: sample rate must be positive" << endl;
return;
}
sizeovrsr_ = (double)tabsize / (double)srate
if(freq < 20 || freq > 20000) {
cout << "Error: frequency is out of audible range" << endl;
return;
}
curfreq_ = freq;
curphase_ = 0.0 // Not out of one, out of tabsize
incr_ = curfreq * sizeovrsr_;
for(int i = 0; i < tabsize; i++) {
gtable.push_back(sin((i*TWOPI)/(double)tabsize));
}
gtable.push_back(gtable[0]);
}
void print_table()
{
vector<double>::size_type i;
for(i = 0; i < gtable.size(); i++)
cout << gtable[i] << "n";
cout << endl;
}
Oscillators.h
#ifndef GUARD_OSCILLATORS_H
#define GUARD_OSCILLATORS_H
#include <vector>
class oscillator {
public:
/*
void fill_sine(); // Will change the table to a sine wave
void fill_square(); // Will change the table to a square wave
void fill_sawtooth(); // Will change the table to a sawtooth wave
void fill_triangle(); // Will change the table to a triangle wave
double tick(double freq); // Will output the current sample and update the phase
*/
void print_table(); // Will print all table values to standard output
oscillator(int srate = 44100, double freq = 200, int tabsize = 8192);
private:
double sizeovrsr_; // Will be set at initialization and will determine phase increase for tick func
double curphase_;
double curfreq_; // if the freq sent to a tick function doesn't match the current tick, it will be reset;
double incr_;
std::vector<double> gtable_; // Will contain a wavetable with a guard point.
}
#endif
I’ve seen other suggestions that mention using g++ -Wall -g but I’m not sure that that is the problem, and that there is something else going on here.
Any help would be much appreciated! Thanks!!
Loading
Offline
Зарегистрирован: 15.08.2020
Код ошибки «Arduino: 1.8.13 (Windows 10), Плата:»Arduino Nano, ATmega328P (Old Bootloader)»
In file included from C:UsersПенёкDocumentsArduinosketch_aug15asketch_aug15a.ino:4:0:
C:Users����DocumentsArduinolibrariesTime-master/Time.h:1:2: warning: #warning «Please include TimeLib.h, not Time.h. Future versions will remove Time.h» [-Wcpp]
#warning «Please include TimeLib.h, not Time.h. Future versions will remove Time.h»
^~~~~~~
sketch_aug15a:9:11: error: expected unqualified-id before numeric constant
C:UsersПенёкDocumentsArduinosketch_aug15asketch_aug15a.ino: In function ‘void setup()’:
sketch_aug15a:120:7: error: unable to find numeric literal operator ‘operator»»dig_display.init’
C:UsersПенёкDocumentsArduinosketch_aug15asketch_aug15a.ino: In function ‘void loop()’:
C:UsersПенёкDocumentsArduinosketch_aug15asketch_aug15a.ino:166:27: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
sketch_aug15a:195:10: error: unable to find numeric literal operator ‘operator»»dig_display.display’
sketch_aug15a:197:10: error: unable to find numeric literal operator ‘operator»»dig_display.display’
sketch_aug15a:199:10: error: unable to find numeric literal operator ‘operator»»dig_display.display’
sketch_aug15a:201:10: error: unable to find numeric literal operator ‘operator»»dig_display.display’
sketch_aug15a:203:10: error: unable to find numeric literal operator ‘operator»»dig_display.point’
exit status 1
expected unqualified-id before numeric constant
Этот отчёт будет иметь больше информации с
включенной опцией Файл -> Настройки ->
«Показать подробный вывод во время компиляции»»
Сам код:
#include
#include
#include
#include
#include «TM1637.h»
#define CLK 6
#define DIO 5
TM1637 4dig_display(CLK, DIO);
// для данных времени
int8_t ListTime[4]={0,0,0,0};
// для данных dd/mm
int8_t ListDay[4]={0,0,0,0};
// разделитель
boolean point=true;
// для смены время / день-месяц
unsigned long millist=0;
tmElements_t datetime;
OLED myOLED(4, 3, 4); //OLED myOLED(SDA, SCL, 8);
extern uint8_t SmallFont[];
extern uint8_t MediumNumbers[];
extern uint8_t BigNumbers[];
///// часы ..
byte decToBcd(byte val){
return ( (val/10*16) + (val%10) );
}
byte bcdToDec(byte val){
return ( (val/16*10) + (val%16) );
}
void setDateDs1307(byte second, // 0-59
byte minute, // 0-59
byte hour, // 1-23
byte dayOfWeek, // 1-7
byte dayOfMonth, // 1-28/29/30/31
byte month, // 1-12
byte year) // 0-99
{
Wire.beginTransmission(0x68);
Wire.write(0);
Wire.write(decToBcd(second));
Wire.write(decToBcd(minute));
Wire.write(decToBcd(hour));
Wire.write(decToBcd(dayOfWeek));
Wire.write(decToBcd(dayOfMonth));
Wire.write(decToBcd(month));
Wire.write(decToBcd(year));
Wire.endTransmission();
}
void getDateDs1307(byte *second,
byte *minute,
byte *hour,
byte *dayOfWeek,
byte *dayOfMonth,
byte *month,
byte *year)
{
Wire.beginTransmission(0x68);
Wire.write(0);
Wire.endTransmission();
Wire.requestFrom(0x68, 7);
*second = bcdToDec(Wire.read() & 0x7f);
*minute = bcdToDec(Wire.read());
*hour = bcdToDec(Wire.read() & 0x3f);
*dayOfWeek = bcdToDec(Wire.read());
*dayOfMonth = bcdToDec(Wire.read());
*month = bcdToDec(Wire.read());
*year = bcdToDec(Wire.read());
}
///// температура ..
float get3231Temp(){
byte tMSB, tLSB;
float temp3231;
Wire.beginTransmission(0x68);
Wire.write(0x11);
Wire.endTransmission();
Wire.requestFrom(0x68, 2);
if(Wire.available()) {
tMSB = Wire.read(); //2’s complement int portion
tLSB = Wire.read(); //fraction portion
temp3231 = (tMSB & B01111111); //do 2’s math on Tmsb
temp3231 += ( (tLSB >> 6) * 0.25 ); //only care about bits 7 & 8
}
else {
//oh noes, no data!
}
return temp3231;
}
void setup()
{
Serial.begin(9600); // запустить последовательный порт
// запуск дисплея
4dig_display.init();
// яркость дисплея
//tm1637.set(7);
Serial.begin(9600);
myOLED.begin();
Wire.begin();
// установка часов
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
second = 30;
minute = 0;
hour = 14;
dayOfWeek = 3; // день недели
dayOfMonth = 1; // день
month = 4;
year = 14;
//setDateDs1307(00, 40, 15, 6, 15, 8, 2020);
}
void loop(){
byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
char week[8][10] = {«Monday», «Tuesday», «Wednesday», «Thursday», «Friday», «Saturday», «Sunday»};
getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
char time[10];
char data[11];
snprintf(time, sizeof(time),»%02d:%02d:%02d»,
hour, minute, second);
snprintf(data, sizeof(data), «%02d/%02d/%02d»,
dayOfMonth, month, year);
myOLED.setFont(SmallFont);
myOLED.print(time, CENTER, 15);
myOLED.print(data, CENTER, 0);
myOLED.printNumF(get3231Temp(), 2, 55, 30);
myOLED.print(«C», 43, 30);
myOLED.update();
// получение времени
if (RTC.read(datetime)) {
ListTime[0]= datetime.Hour/10;
ListTime[1]= datetime.Hour%10;
ListTime[2]= datetime.Minute/10;
ListTime[3]= datetime.Minute%10;
ListDay[0]= datetime.Day/10;
ListDay[1]= datetime.Day%10;
ListDay[2]= datetime.Month/10;
ListDay[3]= datetime.Month%10;
}
else {
// ошибка
4dig_display.display(0,ListDay[0]);
4dig_display.display(1,ListDay[1]);
4dig_display.display(2,ListDay[2]);
4dig_display.display(3,ListDay[3]);
4dig_display.point(false);
}
delay(500);
// поменять индикацию точек
point=!point;
delay(1000);
}
I have the same issue trying to merge C with c++here are the errors i get, can someone please help
warning: unused variable ‘ret’ [-Wunused-variable]
int ret;
^~~
Compiling .piobuildesp-wrover-kitcbortinycborsrccborencoder.o
Compiling .piobuildesp-wrover-kitcbortinycborsrccborparser_dup_string.o
Compiling .piobuildesp-wrover-kitcbortinycborsrccborparser.o
Compiling .piobuildesp-wrover-kitcbortinycborsrccborpretty.o
Compiling .piobuildesp-wrover-kitcbortinycborsrccbortojson.o
Compiling .piobuildesp-wrover-kitcbortinycborsrccborvalidation.o
Compiling .piobuildesp-wrover-kitcbortinycborsrcopen_memstream.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcaddress.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcasync.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcblock.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrccoap_asn1.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrccoap_cache.o
Compiling .piobuildesp-wrover-kitcoaplibcoapsrccoap_debug.o
In file included from src/wisekey_Http_Request_Manager.cpp:60:
include/wisekey_Tools.h: In function ‘void setup()’:
include/wisekey_Tools.h:10:8: error: expected unqualified-id before string constant
extern «C»
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/types.h:34,
from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:37,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/settings.h:52:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/types.h:35,
from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:37,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/wc_port.h:33:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:37,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/types.h:38:16: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/tfm.h:47,
from lib/wolfssl/src/wolfssl/wolfcrypt/integer.h:39,
from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:46,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/random.h:45:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/integer.h:39,
from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:46,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/tfm.h:50:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:61,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/sha.h:60:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:64,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/md5.h:42:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:67,
from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/asn_public.h:39:12: error: expected unqualified-id before string constant
extern «C» {
^~~
In file included from include/wisekey_Crypto_Tools.h:10,
from src/wisekey_Http_Request_Manager.cpp:61:
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:74:12: error: expected unqualified-id before string constant
extern «C» {
^~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2494:52: error: ‘word32’ has not been declared
WOLFSSL_LOCAL int DecodeAsymKey(const byte* input, word32* inOutIdx,
^~~~~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2495:5: error: ‘word32’ has not been declared
word32 inSz, byte* privKey, word32* privKeyLen, byte* pubKey,
^~~~~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2495:33: error: ‘word32’ has not been declared
word32 inSz, byte* privKey, word32* privKeyLen, byte* pubKey,
^~~~~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2496:5: error: ‘word32’ has not been declared
word32* pubKeyLen, int keyType);
Compiling .piobuildesp-wrover-kitcoaplibcoapsrccoap_time.o
^~~~~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2500:54: error: ‘word32’ has not been declared
WOLFSSL_LOCAL int SetAsymKeyDer(const byte* privKey, word32 privKeyLen,
^~~~~~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2501:25: error: ‘word32’ has not been declared
const byte* pubKey, word32 pubKeyLen, byte* output, word32 outLen,
^~~~~Compiling .piobuildesp-wrover-kitcoaplibcoapsrcencode.o
~
lib/wolfssl/src/wolfssl/wolfcrypt/asn.h:2501:57: error: ‘word32’ has not been declared
const byte* pubKey, word32 pubKeyLen, byte* output, word32 outLen,
^~~~~~
In file included from include/wisekey_Crypto_Tools.h:11,
from src/wisekey_Http_Request_Manager.cpp:61:
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcmem.o
lib/wolfssl/src/wolfssl/wolfcrypt/aes.h:126:12: error: expected unqualified-id before string constant
extern «C» {
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcnet.o
^~~
In file included from src/wisekey_Http_Request_Manager.cpp:61:
include/wisekey_Crypto_Tools.h:14:8: error: expected unqualified-id before string constant
extern «C»
Compiling .piobuildesp-wrover-kitcoaplibcoapsrcoption.o
^~~
src/wisekey_Http_Request_Manager.cpp:69:1: error: a function-definition is not allowed here before ‘{‘ token
{
^
src/wisekey_Http_Request_Manager.cpp:91:1: error: a function-definition is not allowed here before ‘{‘ token
{
^
src/wisekey_Http_Request_Manager.cpp:137:1: error: a function-definition is not allowed here before ‘{‘ token
{
^
src/wisekey_Http_Request_Manager.cpp:164:1: error: a function-definition is not allowed here before ‘{‘ token
{
^
src/wisekey_Http_Request_Manager.cpp:416:11: error: ‘sockfd’ was not declared in this scope
close(sockfd);
^~~~~~
src/wisekey_Http_Request_Manager.cpp:416:11: note: suggested alternative: ‘socket’
close(sockfd);
^~~~~~
socket
src/wisekey_Http_Request_Manager.cpp:418:12: error: ‘response’ was not declared in this scope
return response;
^~~~~~~~
src/wisekey_Http_Request_Manager.cpp:418:12: note: suggested alternative: ‘revoke’
return response;
^~~~~~~~
revoke
src/wisekey_Http_Request_Manager.cpp:418:12: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
src/wisekey_Http_Request_Manager.cpp: In function ‘char* findValuebyName(char*, char*)’:
src/wisekey_Http_Request_Manager.cpp:448:27: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
value = malloc(strlen(strseparated) + 2);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:456:12: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
return «null»;
^~~~~~
In file included from src/wisekey_Http_Request_Manager.cpp:59:
src/wisekey_Http_Request_Manager.cpp: In function ‘char* getAccessTokenFromInes(char*)’:
include/wisekey_ZTP_settings.h:28:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
#define IOT_BASE_URL «trustcenter.certifyiddemo.com»
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:461:18: note: in expansion of macro ‘IOT_BASE_URL’
char host = IOT_BASE_URL;
^~~~~~~~~~~~
include/wisekey_ZTP_settings.h:29:25: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
#define IOT_PATH_PREFIX «/iotcms/api»
^~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:462:24: note: in expansion of macro ‘IOT_PATH_PREFIX’
char pathPrefix = IOT_PATH_PREFIX;
^~~~~~~~~~~~~~~
include/wisekey_ZTP_settings.h:30:32: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
#define IOT_API_GET_AUTH_TOKEN «/auth»
^~~~~~~
src/wisekey_Http_Request_Manager.cpp:464:23: note: in expansion of macro ‘IOT_API_GET_AUTH_TOKEN’
char apiSuffix = IOT_API_GET_AUTH_TOKEN;
^~~~~~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:469:23: error: invalid conversion from ‘void‘ to ‘char*’ [-fpermissive]
char api = malloc(str_Size);
~~~~~~^~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:473:21: error: ‘generateHttpHeader’ was not declared in this scope
char headers = generateHttpHeader(host, api, «», NULL);
^~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:477:16: error: ‘http_POSTrequest’ was not declared in this scope
response = http_POSTrequest(host, api, headers, NULL);
^~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:479:65: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
char accessToken = findValuebyName(response, «access_token»);
^
In file included from src/wisekey_Http_Request_Manager.cpp:59:
src/wisekey_Http_Request_Manager.cpp: In function ‘char getCertificateFromInes(char, char*, char*, char*, char*, char*, char*)’:
include/wisekey_ZTP_settings.h:28:22: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
#define IOT_BASE_URL «trustcenter.certifyiddemo.com»
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:490:18: note: in expansion of macro ‘IOT_BASE_URL’
char host = IOT_BASE_URL;
^~~~~~~~~~~~
include/wisekey_ZTP_settings.h:29:25: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
#define IOT_PATH_PREFIX «/iotcms/api»
^~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:491:24: note: in expansion of macro ‘IOT_PATH_PREFIX’
char pathPrefix = IOT_PATH_PREFIX;
^~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:496:23: error: invalid conversion from ‘void‘ to ‘char*’ [-fpermissive]
char *api = malloc(str_Size);
~~~~~~^~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:499:18: error: ‘generateCSRBody’ was not declared in this scope
char body = generateCSRBody(templateId, devicename, CSR, country, 30);
^~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:500:21: error: ‘generateHttpHeader’ was not declared in this scope
char headers = generateHttpHeader(host, api, body, accessToken);
^~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:504:16: error: ‘http_POSTrequest’ was not declared in this scope
response = http_POSTrequest(host, api, headers, body);
^~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:506:31: error: invalid conversion from ‘void‘ to ‘char‘ [-fpermissive]
char responseCpy = malloc(strlen(response) + 1);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:509:59: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
char returncode = findValuebyName(responseCpy, «code»);
^
src/wisekey_Http_Request_Manager.cpp:513:31: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
char issuedCertificate = «null»;
^~~~~~
src/wisekey_Http_Request_Manager.cpp:517:71: warning: ISO C++ forbids converting a string constant to ‘char‘ [-Wwrite-strings]
issuedCertificate = findValuebyName(responseCpy, «certificate»);
^
src/wisekey_Http_Request_Manager.cpp:521:24: error: ‘LOG_ERROR’ was not declared in this scope
WKEY_LOG_DEBUG(LOG_ERROR, «see INES response : rn%s», response);
^~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:521:24: note: suggested alternative: ‘SO_ERROR’
WKEY_LOG_DEBUG(LOG_ERROR, «see INES response : rn%s», response);
^~~~~~~~~
SO_ERROR
src/wisekey_Http_Request_Manager.cpp:521:9: error: ‘WKEY_LOG_DEBUG’ was not declared in this scope
WKEY_LOG_DEBUG(LOG_ERROR, «see INES response : rn%s», response);
^~~~~~~~~~~~~~
src/wisekey_Http_Request_Manager.cpp:521:9: note: suggested alternative: ‘ESP_LOG_DEBUG’
WKEY_LOG_DEBUG(LOG_ERROR, «see INES response : rn%s», response);
^~~~~~~~~~~~~~
ESP_LOG_DEBUG
*** [.piobuildesp-wrover-kitsrcwisekey_Http_Request_Manager.o] Error 1
================================================================================ [FAILED] Took 56.35 seconds ================================================================================
- The terminal process «C:Usersobouamar.platformiopenvScriptsplatformio.exe ‘run’, ‘—target’, ‘upload’, ‘—target’, ‘monitor’, ‘—environment’, ‘esp-wrover-kit'» terminated with exit code: 1.
- Terminal will be reused by tasks, press any key to close it.
Модератор: Модераторы разделов
-
Erok
- Сообщения: 7
- ОС: Slackware 13.0
Решено: Ошибка в stdlib.h
Здравствуйте.
Qt Creator выдаёт ошибку в библиотеке stdlib.h. На Неё же в том же месте ругается и KDevelop. Ошибка следующая:
expected unqualified-id before string constant stdlib.h:35
В программе связывает со строкой
#include <stdlib.h>
Система Slackware 13.0.
Среды: Qt Creator 1.2.1, KDevelop 3.9.91
-
NickLion
- Сообщения: 3408
- Статус: аватар-невидимка
- ОС: openSUSE Tumbleweed x86_64
Re: Решено: Ошибка в stdlib.h
Сообщение
NickLion » 20.12.2009 07:21
А если компилить просто g++, эта ошибка тоже есть? В 35 строчке стоит макрос, который заменяться должен на `extern «C» {`… т.е. ничего страшного. Покажите что-ли код Вашей программы. Думаю причина всё же в ней.
-
Erok
- Сообщения: 7
- ОС: Slackware 13.0
Re: Решено: Ошибка в stdlib.h
Сообщение
Erok » 20.12.2009 08:58
Ошибка только в main.cpp. Привожу его.
Код: Выделить всё
#include <QCoreApplication>
#include "lab3.h"
#include "stdafx.h"
#include <stdlib.h>
#include <iostream>
#include <ctime>
using namespace std;
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
//lab3 foo;
desant t1;
desant t2;
desant t3(t2);
desant t4(2, 3, 2, 1, 200);
desant t5(6, 4, 1, 0, 145);
jumper j;
cout << "nFirst random object:";
t1.show();
cout << "nSecond random object:";
t2.show();
cout << "nCopy of second random object:";
t3.show();
cout << "n1st objact with parametrs:";
t4.show();
cout << "n2st objact with parametrs:";
t5.show();
cout << "nTis is the beter object";
j.jshow();
return 0;
}
-
Erok
- Сообщения: 7
- ОС: Slackware 13.0
Re: Решено: Ошибка в stdlib.h
Сообщение
Erok » 20.12.2009 10:03
Пустая строка есть. Приведу сразу все файлы.
stdafx.h:
Код: Выделить всё
// stdafx.h: включаемый файл для стандартных системных включаемых файлов
// или включаемых файлов для конкретного проекта, которые часто используются, но
// не часто изменяются
//
#pragma once
//#include "targetver.h"
#include <stdio.h>
//#include <tchar.h>
// TODO. Установите здесь ссылки на дополнительные заголовки, требующиеся для программы
lab3.h:
Код: Выделить всё
#ifndef lab3_lab3_H
#define lab3_lab3_H
#include <QtCore/QObject>
#pragma once
class desant
{
int fkoordx;
int fkoordy;
int fname;
int fvertspeed;
int ftime;
int fclass; //0 - десантник, 1 - боевая машина
public:
desant();//конструктор по умолчанию
desant(desant &a);//конструктор копирования
desant(int akoordx, int akoordy, int avertspeed, int aclass, int aname);//конструктор с параметрами
virtual int show();//вывод
~desant();
};
class jumper: public desant
{
int jkoordx;
int jkoordy;
int jname;
int jvertspeed;
int jtime;
public:
jumper();//конструктор по умолчанию
virtual int jshow();//вывод
~jumper();
}
#endif // lab3_lab3_H
lab3.cpp:
Код: Выделить всё
#include "lab3.h"
#include "stdafx.h"
#include<stdlib.h>
#include<iostream>
using namespace std;
desant::desant()
{
fkoordx=rand()%100;
fkoordy=rand()%100;
fname=rand();
fvertspeed=1;
fclass=rand()%2+1;
}
desant::desant(desant &a)
{
fkoordx=a.fkoordx;
fkoordy=a.fkoordy;
fname=a.fname;
fvertspeed=a.fvertspeed;
fclass=a.fclass;
}
desant::desant(int akoordx, int akoordy, int avertspeed, int aclass, int aname)
{
fkoordx=akoordx;
fkoordy=akoordy;
fname=rand()%aname+5;
fvertspeed=avertspeed;
fclass=aclass;
}
int desant::show()
{
cout << "nPersonal number - " << fname << "n";
if(fclass) cout << "This mann"; else cout << "This is warmachinen";
cout << "X coordinate =" << fkoordx << "nY coordinate =" << fkoordy << "n";
cout << "Vertical speed = " << fvertspeed << "n";
return 0;
}
desant::~desant()
{
cout << "DESTRUCTION";
}
jumper::jumper()
{
jkoordx=rand()%100;
jkoordy=rand()%100;
jname=rand();
jvertspeed=2;
}
int jumper::jshow()
{
cout << "nPersonal number - " << jname << "n";
cout << "This great(!) mann";
cout << "X coordinate =" << jkoordx << "nY coordinate =" << jkoordy << "n";
cout << "Vertical speed = " << jvertspeed << "n";
return 0;
}
desant.h:
Код: Выделить всё
#pragma once
class desant
{
int fkoordx;
int fkoordy;
int fname;
int fvertspeed;
int ftime;
int fclass; //0 - десантник, 1 - боевая машина
public:
desant();//конструктор по умолчанию
desant(desant &a);//конструктор копирования
desant(int akoordx, int akoordy, int avertspeed, int aclass, int aname);//конструктор с параметрами
int show();//вывод
~desant();
};