{"action":"created","issue":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/3521","repository_url":"https://api.github.com/repos/esp8266/Arduino","labels_url":"https://api.github.com/repos/esp8266/Arduino/issues/3521/labels{/name}","comments_url":"https://api.github.com/repos/esp8266/Arduino/issues/3521/comments","events_url":"https://api.github.com/repos/esp8266/Arduino/issues/3521/events","html_url":"https://github.com/esp8266/Arduino/issues/3521","id":250252885,"number":3521,"title":"Can't compile using fs.h in a class","user":{"login":"enny1170","id":18047568,"avatar_url":"https://avatars0.githubusercontent.com/u/18047568?v=4","gravatar_id":"","url":"https://api.github.com/users/enny1170","html_url":"https://github.com/enny1170","followers_url":"https://api.github.com/users/enny1170/followers","following_url":"https://api.github.com/users/enny1170/following{/other_user}","gists_url":"https://api.github.com/users/enny1170/gists{/gist_id}","starred_url":"https://api.github.com/users/enny1170/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enny1170/subscriptions","organizations_url":"https://api.github.com/users/enny1170/orgs","repos_url":"https://api.github.com/users/enny1170/repos","events_url":"https://api.github.com/users/enny1170/events{/privacy}","received_events_url":"https://api.github.com/users/enny1170/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-15T08:28:51Z","updated_at":"2017-08-16T10:49:05Z","closed_at":null,"body":"### Basic Infos\r\n\r\n#### Hardware\r\nHardware:\t\twemos d1 mini\r\nCore Version:      \t1.20300.1\r\n\r\n### Description\r\n\r\nI'm try to use FS.h in my class, see Code below. every time im include them i got fallowing Compiler error.\r\n\r\nIn file included from C:\\Users\\e.ziehe\\.platformio\\packages\\framework-arduinoespressif8266\\cores\\esp8266/FS.h:25:0,\r\nfrom lib\\config\\src/ConfigBase.h:13,\r\nfrom lib\\config\\src\\ConfigBase.cpp:8:\r\nc:\\users\\e.ziehe\\.platformio\\packages\\toolchain-xtensa\\xtensa-lx106-elf\\include\\c++\\4.8.2\\bits\\hashtable.h: In constructor 'std::_H\r\nashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(_InputIterator, _InputIter\r\nator, std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1&, c\r\nonst _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&)':\r\nC:\\Users\\e.ziehe\\.platformio\\packages\\framework-arduinoespressif8266\\cores\\esp8266/Arduino.h:253:18: error: expected unqualified-id\r\n before '(' token\r\n#define max(a,b) ((a)>(b)?(a):(b))\r\n\r\nI can use fs.h directly in my .ino file. This will compiled successfully. \r\nI searched around but can't find a solution or helpfull Suggestion. So i'm guess this is caused by my includes or order of includes. I'm not an expert in c++. Please help to fix this.\r\n\r\n### Settings in IDE\r\n\r\nModule:  \t\t\twemos d1 mini\r\nFlash Size: \t\t4MB\r\nCPU Frequency:\t\t80Mhz\r\nFlash Mode:\t\t\t?qio?\r\nFlash Frequency:\t?40Mhz?\r\nUpload Using:\t\tSERIAL\r\nReset Method:\t\tck\r\n\r\n\r\n### Sketch\r\n\r\n```cpp\r\n\r\n///////////////////////////////////////////////////////////\r\n//  ConfigBase.h\r\n//  Implementation of the Class ConfigBase\r\n//  Created on:      10-Aug-2017 23:42:46\r\n//  Original author: e.ziehe\r\n///////////////////////////////////////////////////////////\r\n\r\n#ifndef _CONFIGBASE_H_\r\n#define _CONFIGBASE_H_\r\n\r\n// #undef min\r\n// #undef max\r\n#include <FS.h>\r\n#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson\r\n//#include <Arduino.h>     //https://github.com/arduino/Arduino\r\n#include <ESP8266WiFi.h>\r\n//#include <Hash.h>\r\n#include <unordered_map>\r\n\r\n/**\r\n * Minimum Implementation for JSON Configuration\r\n */\r\nclass ConfigBase\r\n{\r\n\r\npublic:\r\n\tConfigBase();\r\n\tvirtual ~ConfigBase();\r\n\tchar* Key;\r\n\t/**\r\n\t * This is a Hashtable of Params as String, you can Add by using Params_Add an\r\n\t * take the Value by Params_Get. Also Iteration is possible by fallowing Code\r\n\t * for(auto (and)itr : ParamsList)\r\n\t * {\r\n\t *   Printf(\"key: %s, value: %s\",itr.first,itr.second);\r\n\t * }\r\n\t */\r\n\tstd::unordered_map<const char*,const char*> ParamsList;\r\n\t//std::list<String> ParamsList;\r\n\r\n\tvirtual char* GetKey();\r\n\tvirtual String GetRawConfigFile(char* filename);\r\n\tvirtual void SetKey(char* newVal);\r\n\t/**\r\n\t * Build a Json String from Configuration Object, has to be overwritten in Your\r\n\t * implementation. Have in your mind if isRoot so we have to build a valid\r\n\t * Document, Is not we have to build as String with Key\r\n\t */\r\n\tvirtual String BuildConfigString(bool isRoot = false);\r\n\t/**\r\n\t * Writes the _rawConfiguration Json String to SPIFS File\r\n\t */\r\n\tvirtual void WriteRawConfigFile(char* filename);\r\n\r\n\t/** \r\n\t * Parse the Content of a Json String and setup ParamsList\r\n\t */\r\n\tbool ParseConfigString(String jsonString);\r\n\tbool ParseConfigFile(char* filename);\r\n\t//void Params_Add(String key, String newValue);\r\n\t//void Params_Add(char * key,char * newValue);\r\n\tvoid Params_Add(const char *key, const char * newValue);\r\n\t//void Params_Add(const char *key, char * newValue);\r\n\t//char* Params_Get(String key);\r\n\t//char* Params_Get(char * key);\r\n\tconst char* Params_Get(const char * key);\r\n\t\r\n\t/**\r\n\t * This Method can be used to Set DefaultConfig shoul be overwritten in your Implementation\r\n\t */\r\n\tvirtual void SetDefaults(bool write=false);\r\nprivate:\r\n    String _rawConfiguration;\r\n};\r\n#endif \r\n```\r\n\r\n### Debug Messages\r\n\r\n```\r\nmessages here\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/esp8266/Arduino/issues/comments/322733876","html_url":"https://github.com/esp8266/Arduino/issues/3521#issuecomment-322733876","issue_url":"https://api.github.com/repos/esp8266/Arduino/issues/3521","id":322733876,"user":{"login":"enny1170","id":18047568,"avatar_url":"https://avatars0.githubusercontent.com/u/18047568?v=4","gravatar_id":"","url":"https://api.github.com/users/enny1170","html_url":"https://github.com/enny1170","followers_url":"https://api.github.com/users/enny1170/followers","following_url":"https://api.github.com/users/enny1170/following{/other_user}","gists_url":"https://api.github.com/users/enny1170/gists{/gist_id}","starred_url":"https://api.github.com/users/enny1170/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enny1170/subscriptions","organizations_url":"https://api.github.com/users/enny1170/orgs","repos_url":"https://api.github.com/users/enny1170/repos","events_url":"https://api.github.com/users/enny1170/events{/privacy}","received_events_url":"https://api.github.com/users/enny1170/received_events","type":"User","site_admin":false},"created_at":"2017-08-16T10:49:04Z","updated_at":"2017-08-16T10:49:04Z","body":"What i found on Internet sounds like this. But in can’f find any description how to work around this. Maybe you can Point me in the right direction.\n\n\nVon: Phil Bowles<mailto:notifications@github.com>\nGesendet: Dienstag, 15. August 2017 11:48\nAn: esp8266/Arduino<mailto:Arduino@noreply.github.com>\nCc: enny<mailto:e.ziehe@outlook.com>; Author<mailto:author@noreply.github.com>\nBetreff: Re: [esp8266/Arduino] Can't compile using fs.h in a class (#3521)\n\n\nI believe this is due to the way the stdlib redefines the min and max macros - I've had the same problem myself. There are several solutions around if you srat searching around that as the source of the problem\n\n—\nYou are receiving this because you authored the thread.\nReply to this email directly, view it on GitHub<https://github.com/esp8266/Arduino/issues/3521#issuecomment-322426616>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ARNiUCpXWda02zw7n4pvlJRApI_KTgFFks5sYWlTgaJpZM4O3UpY>.\n\n"}}
{"actor":{"display_login":"enny1170"}}