I have a project in Eclipse. The version of OS is 4.24 (firmware is 663d for q2686). So when i try to add new C file in the project i recieve an error during compilation
For example:
I create the project based on Hello_World sample with use Open AT Project Wizard.
The project by default contains a file hello_world.c.
I create a new C file by open File-New-C Source File with new.c name.
In hello_world.c file i insert include directive on my new.c file #include ânew.câ.
Then when i try to buid project i receive error: ânew.c: No such file or directoryâ.
ârenaming new.c into new.h does not bring result: ânew.h: No such file or directoryâ.
âincluding this file manually in project settings by project - properties - include paths and symbols - add folder/file also does not bring result.
Iâm guessing that you have two problems:
[]You didnât specify, but Iâm guessing that you saved new.c in the âsrcâ directory, where hello_world.c is. Since you are #including the file, you may need to move the file to the âitfâ directory.[/]
[]After adding any files to your project, you need to rerun the Project Wizard (or whatever itâs called) or run the wmnew command line tool.[/]
Has understood. As a result it was necessary to move before compilation a new file in a folder inc. Further it is necessary to restart project wizard and go to Project - Clean. That is working.
Types.c about which I told this new name of a file earlier.
I really badly understand in programming on âCâ, especially on eclipse platform (itâs new for me). The purpose was that: to allocate a part of code in other file for simplification of work with a code.
In that case, you would probably find it a lot easier to learn âCâ programming on a ânormalâ platform like a PC before moving on to the added complications of embedded programming in general and Open-AT in particular.
There are plenty of books and courses availableâŚ
Itâs basic âCâ stuff - nothing to do with any particular tool set.
A decent textbook and/or âCâ programming course will show you how to do thisâŚ
Itâs basic âCâ stuff - nothing to do with any particular tool set.
Yes, you are rigth. But i think that my experience of development for PC will allow quickly to start to development applications for OEM wavecom devices.
I do not see a basic difference for itself. And about the books. I have bought couple of books about âCâ Now I read Stepen Kochan âProgramming in Câ. Good texture. Who can that tell?
The problem with code splitting is solved. Was to read a few books under the programming language enough
But now I have faced other problem. Certainly the moderator can scold me for offtopic message but not to produce new themes, I will write here.
How to initialize a variable during its declaration in a header file?
Here an example from âQueryAppâ by Wavecom (âŚfrom xxxxx.h file):
/* Boolean Variable which indicates if the Location information retrieved by the
CGPS library is valid or not */
bool LocValid = FALSE;
/* Variable which saves the last state of the LED (ON/OFF) */
u8 led=0;
And its from my header file:
bool DebugInfoView = FALSE;
Thus compilation comes to an end with an error: c:\OpenAT\IDE\MINGW\3.8.0.1\bin\make.exe: *** [make_single_bin] Error 1
Done.
It is necessary to change the line to:
bool DebugInfoView;
And this case all works well.
What am I do incorrectly? What i have to do to initialise this variable?
âexternâ tells the compiler that the variable is declared in another file, which gets resolved by the linker at the end. The way you were doing it, you were trying to create a new DebugInfoView variable for each C file that included it (which causes problems once the linker tries to merge the object files into one binary).
Thanks indeed for help. Of course, this path will be the most correct. This i understood.
I do not understand how does an example of Wavecom? There is no declaration external variable and initialized in the header file.
I am learning all the time. Almost constantly
Perhaps my English gives ambiguous concept of my thoughts, but i very much hope that those who read this - can understand that i would like to convey to them.
Yes, now i saw my error. Agree with you. Proposal
should write in another form: How to initialize a variable during its definition in a header file?
You should not be placing a definition in a header file!
Keep your definitions (and, therefore, initialisations) in .c files only;
Have only declarations in your .h files
That way, you canât go wrong.
Yes, there are cunning prepreocessor tricks that you can play to create a âdual-purposeâ header - but you really needs to understand the basics first.