We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am a long-time assembler guy in 8051's and PICs, and just got my new Keil C51 IDE package. I am, not fluent in 'C' or Keil tools (yet). I have to look at someone else's existing code and compile it, but I get errors after loading their project and trying a build. Since I am new to the tool set, I am stumped on figuring out what is wrong. Is anyone out there who would take this set of files and help me figure out how ot get it to compile, or what is missing, for a fee? I could send the files and maybe you could help me understand what is wrong or missing? If I was more fluent with the tool set, I could get there myself, but time is critical. Can anyone help? (If this is posed in the wrong place, please forgive me!) Chris
Why not present us the error messages?
I am, not fluent in 'C' or Keil tools (yet). I have to look at someone else's existing code and compile it, but I get errors after loading their project and trying a build
put the Keil on the shelf and get your C practiced on the PC. The C51 is just about the worst possible environment for learning C. Also, "learning" C by "studying code" will make you stumble over the most basic concepts when you try making new code.
Erik
Sorry, but I don't have that choice. I have a Keil C project done by someone else that I have to learn and understand (so I can fix it). I am fluent in the C51 architecture, just not 'C' or the Keil tool set.
I don't know if this will help, but here it is:
Build target 'Target 1' compiling main_standalone.c... main_standalone.c(25): warning C206: 'PORT_init': missing function-prototype main_standalone.c(52): warning C206: 'Init_ADC': missing function-prototype main_standalone.c(60): warning C206: 'Init_SpiMaster': missing function-prototype main_standalone.c(63): warning C206: 'Read_Calibration_Values': missing function-prototype main_standalone.c(97): warning C206: 'CheckThresholds': missing function-prototype main_standalone.c(100): warning C206: 'CheckCurrent': missing function-prototype main_standalone.c(107): error C231: 'CheckThresholds': redefinition main_standalone.c(164): error C231: 'CheckThresholds': redefinition main_standalone.c(166): error C231: 'CheckCurrent': redefinition
If you are interested in hiring a consultant, you could look here.
http://www.keil.com/condb/
-Walt
I was really hoping to find someone who could "look over my shoulder" and help me get off the ground with this. I can do it if I struggle through, but some help at first would send me on my way faster, that's all.
What's odd to me is that the code includes a "project file", and when I load it I get multiple "main" files. I can't tell how the build figures out which one to use.
Chris
Thanks, Walt! That's what I was looking for (I think)! Chris
As suggested earlier, that sounds like a Consultant role...
Here's my suggestions on 'C' learning resources:
blog.antronics.co.uk/.../
Make sure you have a header file with the correct prototypes. Include this header in all files that uses the functions - and in the file that contains the implementation.
CheckThresholds() has extra problems because the compiler made an assumption when not having a prototype to rely on. When it finally saw the implementation it detected the error in assumption.
That should solve your current warninngs - but the issue is that you need to understand what you are doing.
main_standalone.c(25): warning C206: 'PORT_init': missing function-prototype
That one's bad enough, but not fatal. It's telling you that the function given in the message has not been explained to the compiler properly, before it was used.
Now this, OTOH:
main_standalone.c(107): error C231: 'CheckThresholds': redefinition
is an entirely different matter. This means that for whatever reason there are two implementations of the same function being presented to the compiler. That's an inexcusable blunder.
This means that your task has been incorrectly stated. This cannot be bug-hunting in an existing program, because there clearly is no existing program.
"is an entirely different matter. This means that for whatever reason there are two implementations of the same function being presented to the compiler."
Probably not two implementations.
Just a call where the compiler warned about missing prototype, but compiler made an assumption.
Some lines later, it finally got to the implementation and found the assumption wrong. Then time for the error.
But how would that explanation account for getting two "redefinition" errors for the same function?
Just that line 164 doesn't look like an implementation - next error at 166. Unless we are talking one-liners.
That is my vote is that a header file is missing, or not being included. with a possibility of a conditional compile problem.
basically what you are looking for is either: a file that has just the function declaration followed by a semicolon (No Code) just like an extern in ASM. This would be in a file with a .h extension.
The second would be the declarations are in a #if directive, and are not being included.
Note: start at the first error and work down. a single error can confuse the compiler and create 100 error messages for perfectly good code.
Thanks for the input, fellas. After some time, I was given yet another set of files and this time the project compiles OK. Frustrating. What I seem to have is a terribly disorganized and haphazard programmer from whom I have inherited a real mess. (Anyone who thinks that C is "self-documenting" should see this garbage!)
Now I start again and try to understand this, but at least now I have a version that compiles.
Thanks again, and I will look for a consultant for help.
'C' is just a tool - it can be used well, or it can be used badly.
However, understanding any source code does require that you are familiar with the language - its syntax, semantics, and idioms.