Go Down

Topic: Sketch compiles on one computer, but not another (Read 544 times) previous topic - next topic

chrisfredriksson

Hey all,

I'm having a bit of troubles.. Probably not so much library specific, but general language problems..


I'm using Arduino 1.8.2 on both computers, same libraries installed on both as well.

The errors I get are like;

Code: [Select]
invalid conversion from 'const unsigned char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive]

That's for code;
Code: [Select]
printMAC(mac, 6); Serial.println(F(""));

That is my own function, so ok.. lets just comment that out..

But then I get the same error above for;
Code: [Select]
Ethernet.begin(mac);


For the Ethernet library!!.. wtf..


Next error, when I remove "const" from the declaration above so that it passes, is;

Code: [Select]
invalid conversion from 'unsigned char*' to 'const char*' [-fpermissive]


That is for code;
Code: [Select]
else if ( strcmp( _packet, sysOutP1off ) == 0 )


So.. why does my complete code work on my home PC and my arduino setup at home, but not at all at work with the same version of the software and libraries installed?!

I've also uninstalled, removed the sketch folder with libraries and resetted everything on my work computer, then reinstalled everything with the same versions as I got at home.. Still not working!


Please help me out if you can!

PaulS

Code: [Select]
printMAC(mac, 6); Serial.println(F(""));
What purpose is served by wrapping an empty string in the F() macro? What purpose is there in even printing an empty string?

Why the f**k are you putting multiple statements on one line? When the compiler says "I don't like line 36" and you have 12 statements on line 36, you haven't a clue which statement it doesn't like.

Quote
but not at all at work with the same version of the software and libraries installed?!
You clearly do NOT have the same software in both places.

What the compiler is telling you is that a string literal has a type of const char *. The functions you are using expect arguments (sometimes incorrectly) of type char *. You can cast a literal to be a char *, like so:

Code: [Select]
   Ethernet.begin((char *)mac));

That assumes that you have incorrectly defined mac as

Code: [Select]
   char *mac = (char *)"this is not the correct way to define a mac address";

strcmp() defines both arguments as const char *, to assure you that it will not diddle with the contents of the strings being compared. If you are passing it something that is not a const char *, cast it to a const char *. Or, ignore the warning, because it is ONLY a warning.
The art of getting good answers lies in asking good questions.

chrisfredriksson

WHAT HAVE I DONE TO YOU!? Relax your language..



Code: [Select]
printMAC(mac, 6); Serial.println(F(""));
What purpose is served by wrapping an empty string in the F() macro? What purpose is there in even printing an empty string?

Why the f**k are you putting multiple statements on one line? When the compiler says "I don't like line 36" and you have 12 statements on line 36, you haven't a clue which statement it doesn't like.
You clearly do NOT have the same software in both places.

What the compiler is telling you is that a string literal has a type of const char *. The functions you are using expect arguments (sometimes incorrectly) of type char *. You can cast a literal to be a char *, like so:

Code: [Select]
   Ethernet.begin((char *)mac));

That assumes that you have incorrectly defined mac as

Code: [Select]
   char *mac = (char *)"this is not the correct way to define a mac address";

strcmp() defines both arguments as const char *, to assure you that it will not diddle with the contents of the strings being compared. If you are passing it something that is not a const char *, cast it to a const char *. Or, ignore the warning, because it is ONLY a warning.

shanevanj

Did you resolve this - I seem to have a similar issue and unlike our our friend below, who so eloquently put it - I don't have multiple statements per line and yes the two machines are identical installs - with GCC the same version, The library and sketch folders are shared via a synchronized Google drive share!



Delta_G

No, he obviously just got mad at the way @PaulS spoke to him and quit.  It's a shame how thin the skin is on some of these folks and how quickly they completely forget the hobby once the first person gives them the slightest offense. 
If at first you don't succeed, up - home - sudo - enter.

chrisfredriksson

Delta_G
I did not quit, don't assume things.. But getting sentences with F**K right up my face is just plain rude and that person does not need to be around on a forum..

Don't assume I just forget the hobby, there are more ways than a simple forum like this to solve a problem..

Number one rule on ALL forums are normally, be friendly to one another.. But hey, that rule doesn't apply to this forum.. Obviously..

MarkT

Delta_G
I did not quit, don't assume things.. But getting sentences with F**K right up my face is just plain rude and that person does not need to be around on a forum..

Don't assume I just forget the hobby, there are more ways than a simple forum like this to solve a problem..

Number one rule on ALL forums are normally, be friendly to one another.. But hey, that rule doesn't apply to this forum.. Obviously..
I absolutely agree, its a total lack of social skills - but these are open forums, you are welcome to report
stuff to the moderators if you think it crosses the line.  If you can't play nice, you can play elsewhere.

Also sometimes people use strong language, but don't intend offence, but forget to use an emiticon
to qualify the statement, leaving it open to just its literal sense which can be highly offensive.  A lot
of people seem to not even realise different cultures round the world have different standards either.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

AWOL

For the Ethernet library!!.. wtf..

Remind me - what is "wtf" an abbreviation of?

People who live in glasshouses . . .
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

ieee488

No, he obviously just got mad at the way @PaulS spoke to him and quit.  It's a shame how thin the skin is on some of these folks and how quickly they completely forget the hobby once the first person gives them the slightest offense. 
No, it is not thin skin.

I don't like the f-bomb being used.

PaulS is wrong here.

ieee488

#9
Jul 17, 2017, 04:30 pm Last Edit: Jul 17, 2017, 04:31 pm by ieee488
Remind me - what is "wtf" an abbreviation of?

People who live in glasshouses . . .
In the post you are referring to, he's talking to himself as he is going along. I have uttered such things to myself as I am trying to debug code.


But he is right about PaulS's post. Having the f**k thrown in his face is rude.



Delta_G

We should start a new section of the forum for the snowflakes who are more worried about feelings than code.  They could lament all day about how rude this person is or that person is without polluting the rest of the forum. The rest of us who are grown up enough to handle someone saying something we don't like without getting distracted could work on code and helping people write it better and the snowflakes wouldn't have to ever worry about hearing a bad word.


Although I do see the total irony in dude being mad about someone using a word and then using it himself.   I have a feeling this is no snowflake.  This is one of those people who feels the need to be offended all the time to give excuse to cover their own failings.
If at first you don't succeed, up - home - sudo - enter.

Robin2

I have on a number of occasions told-off @PaulS for his choice of language.

However if one is prepared to look past his colourful turn of phrase most things he says represent very sound advice. It seems a pity to throw the baby out with the bath-water.

When I come across some language I don't like I ask myself a simple question "Does this guy know more about my problem than I do?" If he does I am prepared to cut him some slack - and probably call him names in reply.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

AWOL

OK ladies.

This thread has generated more than its fair share of reports to moderation.

Please, everyone - mind your language.
There may be children listening.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Delta_G

"When I come across some language I don't like I ask myself a simple question "Does this guy know more about my problem than I do?" If he does I am prepared to cut him some slack - and probably call him names in reply."

Exactly.  You have a choice to focus on the problem you have with the code and ignore the one post you don't like, or focus on the post you don't like and ignore the code problem. When they go this way all I can think is you must not have been too concerned with the programming problem so why should we waste our time working on it?
If at first you don't succeed, up - home - sudo - enter.

Go Up