+ 1

Why doesn't this code run on sololearn?

I created this code for finding prime numbers. I wrote it and compiled it on the PC and it works. However if I try to run it here on this app, a compilation error happens. Does anyone know why? Also I'd love any feedback on the code itself since I just started programming and I still have much to learn. https://code.sololearn.com/co2Yb1qNd4Bt/?ref=app

4th Aug 2019, 10:44 AM
Nicola Stringari
Nicola Stringari - avatar
2 Answers
+ 3
Compiling your code with clang 8 generates the following warnings: "a.cpp:13:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]  int main () ^ a.cpp:16:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]     ^ a.cpp:16:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]     ^ a.cpp:25:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]     ^ a.cpp:25:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace] ... 108 warnings generated" Apparently, there are some unwanted stray characters in your program that your text editor or IDE might recognize as spaces. In code playground, these unicode characters result in errors of the type: 'stray '/302' in program'. Also when there are a lot of errors in a program, the playground doesn't log errors but instead shows the message 'Compilation Error'. So to fix these errors, remove these Unicode characters.
4th Aug 2019, 11:05 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
I see, I probably should devise a better way to import code from the PC now on since I simply used copy and paste from Gmail not thinking about this kind of thing 😅 Thanks for the quick answer!
4th Aug 2019, 11:10 AM
Nicola Stringari
Nicola Stringari - avatar