S
Spidey
How can to write a c program without a main()
so i can compile and run it
so i can compile and run it
Spidey said:How can to write a c program without a main()
so i can compile and run it
Spidey said:How can to write a c program without a main()
so i can compile and run it
Some systems, particularly embedded systems, may not require a main()
function. (I think some Windows implementations may use something
like "WinMain".) Conforming hosted implementations always require
main().
Joel said:Though it is idiotic but try this .....
#define A main(){
A
printf("hello\n");
}
Keith Thompson said:Some systems, particularly embedded systems, may not require a main()
function.
Why do you want to do this? It seems like another "How do I drive
nails without using a hammer?" question.
Spidey said:How can to write a c program without a main()
so i can compile and run it
Also note that it doesn't conform to C99, which
requires a return type of 'int'.
dear spidey,
there are always rules for the game otherwise things won't go work . C
language has only way as an entry point for a program is main()
function in DOS environment and WinMain () function in Windows
environment.
A function named "main"
Is the one and only thing
A C program needs
Spidey said:How can to write a c program without a main()
so i can compile and run it
Link against a(ny) library (such as cgic) which defines the main function
for you.
neo said:dear spidey,
there are always rules for the game otherwise things won't go work . C
language has only way as an entry point for a program is main()
function in DOS environment and WinMain () function in Windows
environment.
To my knowledge all C compilers are need to follow this standard,
Spidey said:How can to write a c program without a main()
so i can compile and run it
Mike Wahler said:Really? I write quite a few C programs with entry point
'main()' in a Windows environment.
Whether the host environment is DOS, Windows, or something
else, has no bearing at all on the C entry point function's
name.
Frodo Baggins said:Maybe the OP wants to compile a module.
you can have modules without main().
gcc -c module.c
produces just the .o (object) file required for linking.
pete said:A function named "main"
Is the one and only thing
A C program needs
Old said:pete wrote:
Understandable,
notwithstanding freestanding
implementations.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.