I downloaded zip file from github again,but same error
Now on Fedora 25 and CodeBlocks 16.1
I downloaded zip file from github again,but same error
My point is that when I compile cpp file it’s compiled successfully but when I am going to build that project it’s shows same error to that function, How to successfully build that project?
Also when I am making some small changes on message in print function it dose not appear in output of simulator
If do not build succesfully, the executable is not changed = you are running the original program again.
Please always copy-paste the code you are trying here. Then I can test your problem myself.
I am trying to get the same problem to appear as you.
Quick explanation of what is the problem & how to fix. Better explanation coming later.
Problem cause: min max functions are defined in two different places. Standard C library (algorithm.h) and in my library in fake_avr.h
The fake_avr.h definition for min/max is needed for compatibility with Arduino-based code. The problem is that the Arduino version (or actually AVR) is not compatible with C statndard library version
Problem solution: choose what min/max your project uses
1. to use standard C lib version of min/max
Project->Build options->Compiler settings->#defines
add this to end of definitions:
(this is a safety device I added exactly because I knew this problem might appear)
#include <math.h> #include <algorithm>
2. to use AVR min/max
Do not put DISABLEAVRMIN in your project options.
Do not use standard C library math algorithms
Thank you for the explanation. The problem makes alot of sense now. I was just unsure if I was doing something wrong in my code. If we use these standard math functions in our code that aren’t supported by Arduino, the game won’t run on real hardware correct?
Hardware does not care what you use. Use which ever suits you best.
Fake_avr.h is needed only to allow AVR (Arduino) compatibility. The mbed (on which Pokitto is based) is a real C++ environment - if you use std C lib functions, they work exactly according to standard.
Your first solution does not seem to work. <-Ignore this.
The top of my hello.cpp file I have the math.h and algorithm included.
I still get the min not defined in this scope error.
I figured it out. I wasn’t using std:: in front of the functions. I feel dumb. Sorry I’m such a newb!
Also, it didn’t occur to me the max(0,2.2) is invalid whereas max(0.0,2.2) is.
EDIT2 Wow. The compiler even tells me to try std::min.
you can put
using namespace std;
using std::max; using std::min;
In the beginning of your file to only write min instead of std::min
Thanks! that’s way more convenient. .
I can see that you are eager to learn programming, and that is good.
#include declarations belong in the beginning of the hello.cpp file. This is how C/C++ programs are written in general - not just Pokitto
.so files are library files that are needed for compiling the program. In different linux distros they are installed in slightly different locations. You need to install them / find them on your own machine.
Perhaps @drakker can explain? I am not a linux user really.
If you want to start immediately, I suggest that you first read some internet tutorials on C++ programming on Code::Blocks and try to get some simpler programs running. Then coming back to Pokitto Simulator will be a lot easier. You see, Pokitto Simulator is not really an easy way to start - it is a developer tool released early to let the community begin trying out things. It really requires some prior knowledge of programming. I would love to help you out personally, but at the moment I do not have time to support users of Pokitto Sim. We need to focus on getting Pokittos ready to ship.
I am sorry I can not offer you more detailed help on this at the moment - but don’t worry, when Pokitto ships, I will explain getting started step by step.
Thanks for reply, As you said I am aware of basics of C++ and know the code working, what I am eager to get here that why every time and build and run the code it shows me lot of errors and not showing any simple output.
At first time it’s because some function, 2ndly due to misplaced #include due to ambiguity in post readings and now lib files, I am trying to run the same and want to contribute on this Linux destro, If you think I am distracting you then this is not my aim, My aim is to get code running on Fedora destro and further try to contribute with community
Also at the time of joining this community I am fully aware of that I must have some knowledge of C++ and programming basics, As you said earlier I tried install libsdl2-dev on Fedora with no positive results, that’s why I am posting same thing again and again, If you don’t have time no problem , just don’t think that I am completely blank and try to distract you, above misplace of #include occur due to ambiguity in understanding steps of solutions.
No I’d really like to help you out and I’ll do what I can. Linux is not my cup of tea, I can just about manage to get stuff running on it.
I’m really grateful for all community members being here, my intent was to be as positive as I can.
Have patience, all problems will be solved in time.
I have downloaded
If any one figured it out just late know
I was googling your problem and I am stumped. We come to the areas of Linux I am not familiar with. The articles I read indicate that the .so files are for a different target than the program you are trying to compile. How that is possible and whether I am reading it right is unsure.
I really advise trying to compile some SDL2 programs in your setup first, just to see you have a working setup.
This is the way I do it, I start with a simple hello world console program, then I try with a graphics lib example (from SDL2 tutorials) and then move to trying to compile something more difficult (like the Pokitto Sim). Now when I made PokittoSim work on Ubuntu, I did exactly the same process: 1) simple program 2) SDL2 program 3) PokittoSim. In this way I added Linux libs as needed each step.
That’s a linker error, but I’m not sure how it is on Fedora as I haven’t used it in the last 12 years or so. The pre-compiled objects for your architecture are not normally in a /usr/lib* folder, there’s usually another sub directory where the files are compiled for your specific architecture. On Ubuntu its in /usr/lib/x86_64-linux-gnu. You can try finding the libSDL2.so file, it would give you the right directory. You should have some utility to locate files easily on Fedora, no idea where it would be in the graphical interface, but on the command line you should have the locate utility installed and you could use “locate libSDL2.so”. This will find all instances of this file, including the one distributed with the pokitto sim. Once you have found the system file in the list, use that path in your linker’s settings and it should work.
Edit: downloaded the picture to look at it more closely, it was too small on my second monitor to see much. Looks like the culprit is not libSDL2.so but libpulse-mainloop-glib.so.0. This is sound related, pulse audio being an audio wrapper system. You could try disabling sound first and see it it helps. Otherwise, its possible that you might have installed linker files for multiple architectures and its trying to link to the wrong architecture?