ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi everyone!!i'm very happy to be one of the most great linux forums in the world and thanks for all great work that u do here!!
i'm new to linux i have some basic but still newer!!i have a project that i work on!!it's a product that has been installed and compiled in AIX system with xlc compiler!!my job here is to migrate this one to red hat linux entreprise 5 and compile all the makefile with GCC
i'l traying to do the max to find a similarity between xlc and gcc but i'm stuck in one or two option that i can't figure out the solution specially -D option
there is one example of makefile that i do compile but with using the line that contains -D option: gcc -c -DAIX41_OPSYS -I/home/oracle/Open2/COMMON/inc -I/home/oracle/Open2/dbg -DSYSV -D_NO_LONGLONG -I../inc -g -g -c afp_dump.c
i’m gratful if someone help me resolve this !!
Hello,
the -D option tells to GCC preprocessor to define the symbol next to it, so in the given line afp_dump.c is compiled with the AIX41_OPSYS symbol defined, as if you've add "define AIX41_OPSYS" in the file.
There is strange things in the line I can see: -g and -c options appear twice, that certainly means that the Makefile isn't well wrotten.
If you need more info "man gcc" is the way to go.
thanks man for your answer !!as i understand i have to define AIX41_OPSYS in the file afp_dump.c and the compilation will go correctly if u can give me an exeample that explain how this -D option works!!anyway thanks man for your replies again!!!
Nooo!
-DAIX41_OPSYS define the AIX41_OPSYS symbol _AS_IF_ you add "#define AIX41_OPSYS" in every src files you're compiling.
Try this:
Code:
#include <stdio.h>
int main (void) {
#ifdef MY_SYMBOL
printf ("MY_SYMBOL is defined\n");
#else
printf ("MY_SYMBOL is not defined\n");
#endif
retun 0;
}
compile it with and without -DMY_SYMBOL option.
As you want to port from AIX to LINUX I guess that you have to port every pieces of code surrounded by "#ifdef AIX41_OPSYS"
waaaaaaaw!!thanks man ,u are the best!!! now i see what -D option means !!!just one question what do u mean that i have to port every pieces of code surrounded by "#ifdef AIX41_OPSYS"!!belive me your answer was great and after 2 weeks in saerching in the net and no result, u come with a simple and good explaination !!!thanks again !!!
thanks man i foud AIX41_OPSYS in one of my .c files and i found this code!!u think that i can to port to linux:
#if (defined(UNIX_OPSYS) && !defined(sun)) || defined(IRIX53_OPSYS) || defined(AIX41_OPSYS) || defined(AIX)
/****************************************************************************/
/* Function: set_signal() - VERSIONE UNIX */
/* Date L.M.: 26-May-1998 */
/* Description: Assign sig_handler() for all signals */
/****************************************************************************/
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.