RE: [Dev-C++] what is a resource? how do I create my own headers ?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: James G. <Jam...@Cl...> - 2001-01-04 15:35:00
|
A resource file as a Windows text file that contains information about
menus, dialogs, icons, accelerators etc and is normally in a .rc file.
As to the other question.
Create a header to declare your function e.g.
myfunc.h
~~~~~~~~
#ifndef MY_FUNC_H
#define MY_FUNC_H
#ifndef SOURCE_COMPILE
#define EXTERN_ extern
#else
#define EXTERN_
#endif
/* Function func1 prototype */
EXTERN_ int func1(int anumber);
#endif
myfunc.c
~~~~~~~~
#include <stdio.h>
#define SOURCE_COMPILE
#include "func.h"
EXTERN_ int func1(int anumber)
{
return (anumber * 1000);
}
test.c
~~~~~~
#include <stdio.h>
#include "func.h"
int main()
{
return func1(1000);
}
You would normally do one of two things.
1. If the function is to be used in a number of different projects then
creating a library (.lib or .a or .so file) that can be used in other
projects by linking the file using the -l<libname> option.
2. In the makefile specify that you need myfunc.o (which is the intermediate
file from compiling with cc -c myfunc.c).
e.g. cc test.c -o mytest func.o
With MSVC try the following
cl -c func.c
cl test.c func.obj
Regards,
James.
-----Original Message-----
From: Alan Thomas [mailto:ala...@3n...]
Sent: Thursday, January 04, 2001 1:46 AM
To: dev...@li...
Subject: [Dev-C++] what is a resource? how do I create my own headers?
Importance: High
Two questions:
(a) What is a "resource" file? Is it relevant for a [DOS] console program?
Where is it documented what to do with a resource file?
I created a new project (console application) and added three
existing files (two cpp{one with a main function, another with other
functions} and one header file. Asked it to Compile the project, but it
gave me an error with the resources ("no resources"). Tried again with a
new, empty project. Added files but got same error when I attempted to
compile.
(b) How do I save/use a header file?
I have some functions. Wrote and tested them. Took the function
prototypes and #includes, and made them the header file. Included it
(#include "html.h") in my file with the main function. Took the rest ---
the function definitions --- and made them the .cpp file. Is this the way
you use a header file?
Where is this documented or described?
Thanks, Alan
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
This electronic message and any attachment is intended to be
read by the named addressee(s) only.
Any other recipient should be aware that its contents may be
legally privileged and/or confidential and that its use,
disclosure, copying or distribution may be unlawful.
Unless you are a named addressee, please delete this message
Whilst C. & J. Clark International Limited has taken steps
to prevent the transmission of computer viruses with electronic mail,
responsibility for screening incoming messages and the risk of such
transmission and its consequences lies with the recipient.
C. & J. Clark International Limited
Registered in England and Wales
Company No. 141015
Registered Office: 40 High Street, Street, Somerset BA16 0YA
Telephone: +44 (0) 1458 443131
Fax: +44 (0) 1458 447547
|