Never mind. Figured it out. Had a module named foo.C that contained class Foo.
In working on an earlier problem I made a temporary backup copy of foo.C and called it foo_x.C . If I compile just foo.C then the link apparently finds the "current" object file, foo.o, to satisfy the external references to Foo, and all is well. But if I compile all, then (as it happens) foo_x.C gets compiled after foo.C, and apparently the link "finds" class Foo in the old foo_x.o, and not surprisingly, I get the old behavior. Moral of the story: if you are going to make temporary copies of a source file, don't rename them foo_x.C; rename them to foo.C_x or foo.C_old . Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Charles Mills Sent: Thursday, July 26, 2012 3:28 PM To: [email protected] Subject: Question about compiling a C++ directory I'm trying to figure out if I have a fundamental misunderstanding of compiling an entire directory of C++ programs. I compile all of a directory. I link one particular load module comprised of object from that compile. I get behavior "x" from the load module. I compile one of the C++ programs using the same options - the same OPTFILE in fact. I run the same link and the same test. I get behavior "y" from the load module. Should one compile affect another when compiling an entire directory? For example, do #pragmas carry over from one compile to the next? These two ways of doing things has been working for me for years so it is not some gross typo -- it is something very subtle, or a misunderstanding on my part of how a directory compile should work. Here's my "all" JCL: //PROCLIB JCLLIB ORDER=CBC.SCCNPRC //* //* Everything //* //COMPALL EXEC CBCC,CPARM='OPTF(DD:SYSOPTF)',COND=(4,LT) //SYSIN DD PATH='/u/aaa/Source/' //SYSLIB DD PATH='/u/aaa/Source' //SYSLIN DD PATH='/u/aaa/Object/' //SYSOPTF DD DISP=SHR,DSN=AAA.XXX.CNTL(CCOPTF) //* //* Use BPXbatch to build an archive of object code //* //BPXARCH EXEC PGM=BPXBATCH,COND=(4,LT), // PARM='SH cd Object;ar -rvc Xxx.a *.o' //STDIN DD DUMMY //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* Here's my "one source file" JCL (where my submit script makes #MEMBER# into the name: //PROCLIB JCLLIB ORDER=CBC.SCCNPRC //CC EXEC CBCC, // CPARM='OPTF(DD:SYSOPTF)' //SYSIN DD PATH='/u/aaa/Source/#MEMBER#.C' //SYSLIN DD PATH='/u/aaa/Object/#MEMBER#.o', // PATHOPTS=(OWRONLY,OCREAT),PATHMODE=SIRWXU //SYSLIB DD PATH='/u/aaa/Source' //SYSOPTF DD DISP=SHR,DSN=AAA.XXX.CNTL(CCOPTF) //* //* USE BPXBATCH TO ARCHIVE OBJECT CODE //* //BPXARCH EXEC PGM=BPXBATCH,COND=(4,LT), // PARM='SH cd Object;ar -rvc Xxx.a #MEMBER#.o' //STDIN DD DUMMY //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
