I fixed the typo about -lstdc++ that you pointed. Does this fix the
problem?

Yes, this fixes that problem, but now there is another one. It seems as though the linker doesn't understand _mexVersion from mexFunction.map. I ran "nm mjdgges.o" and found that _mexVersion is not defined, which I guess means there must be something wrong in the way it's declared. The output from the build command and from nm are below

MAKE
gcc-4.0  -fno-common -no-cpp-precomp -arch i386 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -fexceptions -O2  -L/Applications/MATLAB_R2007b/bin/maci -Wl,-twolevel_namespace -undefined error -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2007b/extern/lib/maci/mexFunction.map -o mjdgges.mexmaci mjdgges.o  -lmx -lmex -lmat -lstdc++ -lmwlapack -lmwblas
Undefined symbols:
  "_mexVersion", referenced from:
     -exported_symbols_list command line option
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[2]: *** [mjdgges.mexmaci] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

NM
000005f0 s EH_frame1
00000698 S _criterium
         U _dgges_
         U _memcpy
         U _mexErrMsgTxt
00000200 T _mexFunction
00000634 S _mexFunction.eh
00000050 T _mjdgges
00000608 S _mjdgges.eh
         U _mxCalloc
         U _mxCreateDoubleMatrix_730
         U _mxGetM
         U _mxGetN
         U _mxGetPi
         U _mxGetPr
         U _mxIsComplex
         U _mxIsDouble
00000000 T _my_criteria
00000000 A _my_criteria.eh


Great if it compiles. Did you try to run a simple MOD file
(tests/example1.mod) to check if the MEX work fine ? What is the error
message with "make check" ?

I am not able to do this right now as I am getting a different error when building. I guess this error comes from ctangle/cweave, though I have the most up-to-date versions of these programs. Tomorrow I will try to recompile and check the warnings that came out when they were being compiled.

g++ -DPACKAGE_NAME=\"dynare\" -DPACKAGE_TARNAME=\"dynare\" -DPACKAGE_VERSION=\"4.1-unstable\" -DPACKAGE_STRING=\"dynare\ 4.1-unstable\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"dynare\" -DVERSION=\"4.1-unstable\" -DHAVE_BOOST=/\*\*/ -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_BOOST_GRAPH_ADJACENCY_LIST_HPP=1 -DBOOST_NO_HASH=1 -DHAVE_BLAS=1 -DHAVE_LAPACK=1 -DHAVE_PTHREAD=1 -I.  -I../sylv/cc -I../tl/cc -I../integ/cc -DPOSIX_THREADS  -D_THREAD_SAFE  -g -O2 -Wall -MT libkord_a-journal.o -MD -MP -MF .deps/libkord_a-journal.Tpo -c -o libkord_a-journal.o `test -f 'journal.cpp' || echo './'`journal.cpp
journal.cweb: In static member function ‘static long int SystemResources::physicalPages()’:
journal.cweb:57:16: error: ‘_SC_PHYS_PAGES’ was not declared in this scope
journal.cweb: In static member function ‘static long int SystemResources::availableMemory()’:
journal.cweb:71:27: error: ‘_SC_AVPHYS_PAGES’ was not declared in this scope
journal.cweb: In member function ‘void SystemResources::getRUS(double&, long int&, double&, double&, double&, long int&, long int&)’:
journal.cweb:106:19: error: ‘_SC_AVPHYS_PAGES’ was not declared in this scope
journal.cweb: In static member function ‘static long int SystemResources::availableMemory()’:
journal.cweb:72:1: warning: control reaches end of non-void function
journal.cweb: In static member function ‘static long int SystemResources::physicalPages()’:
journal.cweb:58:1: warning: control reaches end of non-void function
make[3]: *** [libkord_a-journal.o] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1