Error: 'import' does not name a type

Hello,

I've stumbled on to a uploading error from the Arduino IDE; specifically example of Arduino code I typed:

import processing.serial.*;

I used the search to look in the forum for any mention of this error. I found many posts concerning this tag. The trouble is that most, if not all, responses do not add a correction to the issue. I would like for those who responded be more educational to those who are asking for help. In essence what I read from those who tried to help, but didn't, are using words like, ".... the code is for processing, not for Arduino...." and ends with no explaination.

Instead of responding with something tort, explain then why code examples uses the syntax and when either copied and pasted from web site Arduino tutorials, or edited from examples published in books get that error.

OK, I hear your explanation for the why error, now explain why its in those examples, and a possible fix for the error.

This is not a valid c++ command... so no surprise it fails...

, “… the code is for processing, not for Arduino…”

That should read ", “… the code is for Processing, not for Arduino…” ".
Processing is basically Java, whereas Arduino (Wiring) is C++

Ok more explanation needed maybe about the word "processing"

Processing with a capital P is a programming environment for your PC / mac. It's often used in combination with an arduino program to get your computer to communicate with your arduino based solution, So examples would usually have 2 matching programs, one for the PC, programmed in Processing environment and one for the arduino IDE.

Makes more sense now?

The two that replied did not answer my question (and pointing out punctuation is to obfuscate the issue). Does any body actually read query posts, or is it just an emotional and terse reaction?

There are those who really need an explanation to problems they face when developing solutions, and when they get responses like these its no wonder they go off to something, or somewhere else.

I'd advise y'all to hold back on quick, short replies, and instead educationally help with solid concise explanations.

Would anybody else try to answer these questions I laid out? Why is the Arduino IDE throwing out these errors when there are examples in books and web sites which have these in THEIR code and when they are copied, pasted and compiled why is it that there are errors made after induced PUNCTUATIONS have been corrected?

Why is the Arduino IDE throwing out these errors when there are examples in books and web sites which have these in THEIR code and when they are copied, pasted and compiled why is it that there are errors made after induced PUNCTUATIONS have been corrected?

The Arduino IDE is complaining because that is NOT an Arduino sketch. All of your whining is not going to make it so.

truthseer:
The two that replied did not answer my question (and pointing out punctuation is to obfuscate the issue). Does any body actually read query posts, or is it just an emotional and terse reaction?

There are those who really need an explanation to problems they face when developing solutions, and when they get responses like these its no wonder they go off to something, or somewhere else.

I'd advise y'all to hold back on quick, short replies, and instead educationally help with solid concise explanations.

Would anybody else try to answer these questions I laid out? Why is the Arduino IDE throwing out these errors when there are examples in books and web sites which have these in THEIR code and when they are copied, pasted and compiled why is it that there are errors made after induced PUNCTUATIONS have been corrected?

do you actually read the answers? may be a picture will help?


(full size image)

the line of code you presented is for the world on the left side of that image. its very close to JAVA in terms of programming language.

Usually that code has a companion code that is for the right side of that image, programmed in C++ for Arduino

Usually the two pieces of code - which are programmed in different programming languages, hence not interchangeable - will exchange information through the Serial Port using the USB cable...

is that clearer?




Now - instead of gesticulating - if you could give us a pointer to such a web site and source code may be we could provide more guidance and explain what you seem to miss...

really we are trying to help

Pointing-out punctuation is something the compiler will do ruthlessly; get used to it.

Punctuation and correct capitalisation convey extra information, and are there for good reason. Programming often comes as a disappointment to those brought-up on txt.

Pointing-out incorrect usage of words like "tort" is something I sometimes do. Again, get used to it.

Still, no answer. READ: …when there are examples in books and web sites which have these in THEIR code and when they are copied, pasted and compiled why is it that there are errors…

Now, is that short and concise?

truthseer:
Still, no answer. READ: ....when there are examples in books and web sites which have these in THEIR code and when they are copied, pasted and compiled why is it that there are errors....

Now, is that short and concise?

too short. give us a pointer to web site.


when there are examples in books and web sites which have these in THEIR code

what we are telling you is that "THEIR code" is not meant to be used in an Arduino. it's for the left side of my picture above - the PC/Mac world, running in the Processing environment on the PC, never uploaded to the Arduino.

And another point. When I pointed out Paul S's, J-M-L's, and AWOL's terse replies with nothing of substance to HELP, what is given in response is more terseness. Are all your narcissistic egos that sensitive? Short terse replies doesn't help anyone. It really is amazing to see the emptiness of your so-called intellect. It seems y'all cannot read a question and give an educated reply.

J-M-L: yes, pictures do help when applied properly. Yours wasn't. Wallowing in narcissistic, emotionally, and visceral charged replies goes no where; and I will point that out.

We're still waiting . . .

More specifically, we're waiting to help, but we can't until you stop waffling, and start providing evidence.

J-M-L,

Good. A solid reply to a question that was supposed to be given in the first place. Why wasn't it given in the beginning? Why was there a brain wrestle instead?

Odd as it may sound, we're still waiting for the evidence, so that others in the future don't trip over the same misconceptions.

Now I'm wondering why @truthseer is looking at the WiFi Shield 101 board, and not posting their evidence here.

It's almost as if @truthseer is not interested in helping others not make the same mistakes s/he made.

truthseer:
J-M-L,

Good. A solid reply to a question that was supposed to be given in the first place. Why wasn’t it given in the beginning? Why was there a brain wrestle instead?

I’m not sure I understand what is the solid reply … I’m not sure I understand where the “brain wrestle” was. You said:

a uploading error from the Arduino IDE; specifically example of Arduino code I typed:
import processing.serial.*;

and you already got the answer “the code is for processing, not for Arduino

So initial thought is you’ve done your research and understand what Procesing is… i point out that you get an error because Arduino IDE language is C++ and the statement is not C++. hence that’s why you get an error.

Then I realize you may be don’t know what Processing is (not the verb, the product name, hence the insistance on capitalization). I mention to you

Ok more explanation needed maybe about the word “processing”

Processing with a capital P is a programming environment for your PC / mac. It’s often used in combination with an arduino program to get your computer to communicate with your arduino based solution, So examples would usually have 2 matching programs, one for the PC, programmed in Processing environment and one for the arduino IDE.

Makes more sense now?

with a link to the Processing web site. have you clicked on it?

then you come back asking why we don’t answer the question… but we all think we did. with text and link…

So I take the time to draw a picture explaining there are 2 different worlds that use two different languages… but still you don’t appreciate the effort I put in building an answer.

Now we have asked many times for the web sites and books that are confusing… and you refuse to answer…

I don’t understand what you don’t understand at this point. you have brought no evidence of web sites and books that could have mislead you…

something I learnt in life is to listen, listen really carefully to what people say and try to understand. I’ve never seen being agressive get anyone on the path of knowledge.

I’m out of ideas on how to answer your question - may be someone else will have more ideas. good luck

J-M-L:
I'm out of ideas on how to answer your question - may be someone else will have more ideas. good luck

He's too involved with the conflict from his high horse to view the links and provide evidence.

This is clearly a genuine misunderstanding on the part of the OP, and the short and terse replies given by certain members here really did seem like the kind of thing that would not only lead the OP to further confusion on this particular issue, but potentially to give up on venturing further into the realm of Arduino/programming. Arduino is supposed to be a helpful and supportive community for beginners to learn and grow, but all too often I see threads like this where more advanced members get too short with beginners much too quickly. We all know that starting out can be quite a frustrating experience, and I think it's important that advanced members keep this in mind when dealing with newer members. The OP even mentioned that he searched in the forum for other errors like this and still hadn't found an answer that satisfied his curiosity. This kind of behavior should be applauded, not attacked.

I apologize for going off topic here, but this seemed a matter of great import. I tried to report individual responses in this thread, but unfortunately the character limit on reports are much lower than on posts. Still, I thought it was important that moderators hear my full opinion on this because, like I said, this kind of group attack on a new member's question is too common here. I hope the moderators can continue to lead this community in the right direction, and get rid of these negative experiences for new members.

To any new members out there who have to see this, I'm sorry. Keep going with your creative drive and hunger for knowledge! I promise it's worth fighting through any frustrations you may face along the way!

but this seemed a matter of great import.

Or a matter of great include. :smiley:

To any new members out there who have to see this

, don't try to compile Java in a C++ environment.

The question is: "why this error are in a book?"