Re: [Dev-C++] Programming with multiple modules/files
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2007-10-13 12:33:17
|
//global.h
#ifndef _GLOBAL_H
#define _GLOBAL_H
#ifdef MAIN
#define EXTERN
#else
#define EXTERN extern
#endif
EXTERN int a;
EXTERN int b;
=2E..
#endif // _GLOBAL_H
// main.c
#define MAIN=09=09// Want all global variables in this file.
#include "global.h"
int main(void) {
...
}
// other.c
#include "global.h"=09// Get info about all global variables
/pwm
On Sat, 13 Oct 2007, Andr=E9 Mac=E1rio Barros wrote:
> Dear users,
>
> Please consider the following project-file
> cenario:
> ///file1.c///////
> #include "global.h"
> main()
> {
> func_x();
> a =3D 100;
> ...
> }
> ///file2.c///////
> extern int a;
> func_x()
> {
> ...
> a=3D300;
> }
> ///global.h///////
> int a;
> void func_x(void);
> ///////////
>
> My problem is:
> 1) I have a lot of file2.c-type files (files with only
> function definitions), a lot of functions
> and several "extern" variable declarations;
> 2) Trying to include global.h in file2.c too, avoids
> the need of declaring all extern variables. But this
> action generates warnings of duplicate includes (2 or
> more include global.h);
> My question is:
> Is there any way to manipulate several file2.c-type files
> without declaring each extern variable?
>
> Regards
> Andre Barros
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.488 / Virus Database: 269.14.9/1068 - Release Date: 13/10/20=
07
> 10:15
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|