Created
October 6, 2012 19:05
-
-
Save cwsmith/3845810 to your computer and use it in GitHub Desktop.
macro calling fn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mis.h | |
================== | |
#define PARMA_MAJOR_VERSION 1 | |
#define PARMA_MINOR_VERSION 0 | |
#define PARMA_PATCH_VERSION 170:177M | |
void mis_init(int randNumSeed, const char* maj, const char* min, const char* patch); | |
//#define misInit(seed) printf("misInit: %d\n", seed) | |
#define misInit(seed) mis_init(seed, PARMA_MAJOR_VERSION, PARMA_MINOR_VERSION, PARMA_PATCH_VERSION) | |
mis.cc | |
================== | |
void mis_init(int randNumSeed, const char* maj, const char* min, const char* patch) { | |
char msg[256]; | |
sprintf("ParMA version %s.%s.%s\n", maj, min, patch); | |
statusPrint(msg); | |
seedRandomNumberGenerator(randNumSeed); | |
} | |
testMIS.cc | |
====================== | |
int main() { | |
misInit(5); // fails | |
} | |
compile output | |
========================= | |
/users/cwsmith/develop/tools/openmpi/openmpi-1.4.3-install/bin/mpicxx -DHAVE_CONFIG_H -I. -I/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma -I./config -DPARALLEL -DFMDB_PARALLEL -DFMDB -D_HAVE_PARMETIS_ -D_HAVE_ZOLTAN_ -I/users/cwsmith/develop/ParMA/parma_build/include/ -I/users/cwsmith/develop/ParMA/parma_build/include -I/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/siter/src -I/users/cwsmith/develop/ParMA/parma_build/include -I/users/cwsmith/develop/ParMA/zoltan/Zoltan_v3.6-install//include/ -I/users/cwsmith/develop/ParMA/parmetis/ParMetis-3.1.1/ -I/users/cwsmith/develop/tools/petsc-3.2-p5-install/include -I/users/cwsmith/develop/tools/petsc-3.2-p5-install//include -I/users/cwsmith/develop/ParMA/parma_build/include -I/users/cwsmith/develop/tools/openmpi/openmpi-1.4.3-install/include -I/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/src -I/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet -g -O0 -MT maximalIndependentSet/test/testMIS.o -MD -MP -MF $depbase.Tpo -c -o maximalIndependentSet/test/testMIS.o /users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc &&\ | |
mv -f $depbase.Tpo $depbase.Po | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(452): error: expected a ")" | |
misInit(randNumSeed); | |
^ | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(452): error: argument of type "int" is incompatible with parameter of type "const char *" | |
misInit(randNumSeed); | |
^ | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(452): error: argument of type "int" is incompatible with parameter of type "const char *" | |
misInit(randNumSeed); | |
^ | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(454): error: expected a ")" | |
misInit(time(NULL)); | |
^ | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(454): error: argument of type "int" is incompatible with parameter of type "const char *" | |
misInit(time(NULL)); | |
^ | |
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc(454): error: argument of type "int" is incompatible with parameter of type "const char *" | |
misInit(time(NULL)); | |
^ | |
compilation aborted for /users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/test/testMIS.cc (code 2) | |
make: *** [maximalIndependentSet/test/testMIS.o] Error 2 |
or maybe
define VER_STR "VER_NUM"
The first results in the compile error:
/users/cwsmith/develop/ParMA/parma_build/SCOREC_Software/parma/maximalIndependentSet/mis.h(72): error: expected a macro parameter name
#define misInit(seed) mis_init(seed, #PARMA_MAJOR_VERSION, #PARMA_MINOR_VERSION, #PARMA_PATCH_VERSION)
to elaborate on option 2:
define SVN_MAJOR_VERSION 1
define PARMA_MAJOR_VERSION "SVN_MAJOR_VERSION"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
define misInit(seed) mis_init(seed, #PARMA_MAJOR_VERSION, #PARMA_MINOR_VERSION, #PARMA_PATCH_VERSION)