| | |
Preprocessor definitions on the command line
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
1. g++ -DHAVE_CONFIG -Wall -std=c++98 -o myprogram
2. ,/myprogram hello world
in 1., the command line args are used by the c preprocessor, some are forwarded to the compiler and linker
in 2., the command line args are passed to myprogram and are available as parameters passed to main
2. ,/myprogram hello world
in 1., the command line args are used by the c preprocessor, some are forwarded to the compiler and linker
in 2., the command line args are passed to myprogram and are available as parameters passed to main
Last edited by vijayan121; Jul 18th, 2007 at 9:53 am.
preprocessor directives/macros are processed at the time of compilation. Arguments relevant to preprocessor (e.g. -DXXX=value) are passed to compiler and used by compiler. Any argument passed on command line is called command line arguments.
. So these are the CLI args to compiler.
After compilation (and linking) the executable of your program is ready.. when you call/execute this executable with CLI args, these would go to main() and will be be available to your program.
. So these are the CLI args to compiler.After compilation (and linking) the executable of your program is ready.. when you call/execute this executable with CLI args, these would go to main() and will be be available to your program.
Are you Agile.. ?
![]() |
Similar Threads
- C command-line I/O question (C++)
- command line (OS X)
Other Threads in the C++ Forum
- Previous Thread: GetTextExtentPoint32 API
- Next Thread: How do i output the contents of the stack with the functions Output ?
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






