element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Arduino Library Compiler Errors
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 10 replies
  • Subscribers 403 subscribers
  • Views 1372 views
  • Users 0 members are here
  • help
  • .h
  • library
  • library_editor
  • code_libraries
  • .cpp
  • arduino_development_environment
  • error
  • compilier
  • arduino
Related

Arduino Library Compiler Errors

8163jb
8163jb over 12 years ago

Hey, I have recently attempted to make a library which enables users to put a scrolling text command along with their AXE133Y Picaxe OLED display, here is the header code:

 

 

     #ifndef ScrollText_h

     #define ScrollText_h

 

 

     #include "Arduino.h"

     #include <AXE133Y.h>

 

 

     class ScrollText

     {

       public:

         scroll(String input);

         String input;

       private:

         String _input;

         int _blank;

         String _output;

         String _output2;

         int _amount;

         char _charBbuf[];

         int _pos;

         int _poss;

     };

 

 

     #endif

 

And here is the .cpp file:

 

     #include "Arduino.h"

     #include "ScrollText.h"

     #include <AXE133Y.h>

 

 

     AXE133Y OLED = AXE133Y(1);

 

 

 

 

     void ScrollText::scroll(String input)

     {

       String _input = input;

       for (int _blank = 16; _blank > 0; _blank--)

       {

         String _output = "";

         String _output2 = "";

         for(int _amount = _blank; _amount >= 0; _amount--)

         {

           _output = _output + " ";

         }

         for (int _amount = 16 - _blank; _amount >= 0; _amount--)

         {

           _output2 = _output2 + " ";

         }

         _output = _output + _input + _output2;

         OLED.cursorHome(1);

         OLED.print(_output);

         delay(150);

       }

       OLED.cursorHome(1);

       OLED.print(" " + _input + " ");

       OLED.cursorHome(1);

       delay(170);

       char _charBuf[_input.length()];

       _input.toCharArray(_charBuf, _input.length() + 1);

       for (int _pos = 0; _pos <= _input.length(); _pos++)

       {

         OLED.cursorHome(1);

         for(int _poss = _pos; _poss <= _input.length(); _poss++)

         {

           OLED.print(String(_charBuf[_poss]));

         }

         OLED.print(" ");

         delay(150 + (_input.length() / 1.5));

       }

       OLED.clearScreen();

     }

 

I can't find any errors with this, yet when I put this code into the Ardunio IDE:

 

     #include <ScrollText.h>

 

 

     void setup()

     {

       ScrollText.scroll("Hello World");

     }

 

 

     void loop()

     {

     }

 

It returns the following errors:

 

"In file included from sketch_feb06a.ino:1:

C:\file system etc... \arduino\libraries\ScrollText/ScrollText.h:14: error: ISO C++ forbids declaration of 'scroll' with no type

sketch_feb06a.ino: In function 'void setup()':

sketch_feb06a:5: error: expected unqualified-id before '.' token"

 

Can anyone tell me why this is happening and how I can fix it? Cheers in advance!

Tom C (15)

  • Sign in to reply
  • Cancel
Parents
  • weissar
    0 weissar over 12 years ago

    Hi, compiler says - " ISO C++ forbids declaration of 'scroll' with no type", so you must write type in declaration of function scroll:

     

    ...

      public:

             void scroll(String input);

    ...

     

    Petr

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • 8163jb
    0 8163jb over 12 years ago in reply to weissar

    I tried what you said and it sorted out that error, so thankyou very much, however, I still get this error when running the code:

     

    sketch_feb06a.ino: In function 'void setup()':

    sketch_feb06a:5: error: expected unqualified-id before '.' token"

     

    Any ideas what I have done wrong here?

     

    Cheers in advance!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • billabott
    0 billabott over 12 years ago in reply to 8163jb

    Did you pull your library from here: https://github.com/ratbum/ScrollText ?

     

    It says it is for 7-Segment display being driven by single shift register.

     

    I don't know, but it might be helpful if we knew where the .h libraries are sourced from.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • billabott
    0 billabott over 12 years ago in reply to 8163jb

    Did you pull your library from here: https://github.com/ratbum/ScrollText ?

     

    It says it is for 7-Segment display being driven by single shift register.

     

    I don't know, but it might be helpful if we knew where the .h libraries are sourced from.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • 8163jb
    0 8163jb over 12 years ago in reply to billabott

    No I wrote it all myself, It is for a 16X2 OLED display. All the code available is in the original post

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube