[ADMB Users] g++ compile and link

Arni Magnusson arnima at hafro.is
Wed Dec 10 12:28:38 PST 2008

To answer Jon Schnute's question 1, here are the scripts I use to 
compile and link separately with GCC. The first four scripts are just 
one long line each:



g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DOPT_LIB -DUSE_LAPLACE 
-fpermissive -I. -I%ADMB_HOME%/include %1.cpp


g++ -c -O3 -Wno-deprecated -D__GNUDOS__ -Dlinux -DOPT_LIB -DUSE_LAPLACE 
-fpermissive -I. -I%ADMB_HOME%/include %1.cpp


g++ -s %1.o -L%ADMB_HOME%/lib -ldf1b2stub -ladmod -ladt -lado 
-ldf1b2stub -ladmod -ladt -lado -o%1


g++ -s %1.o -L%ADMB_HOME%/lib -ldf1b2o -ladmod -ladt -lado -ldf1b2o 
-ladmod -ladt -lado -o%1


tpl2cpp %1
call adcomp %1
call adlink %1


tpl2rem %1
call adcompr %1
call adlinkr %1


My Linux scripts are practically identical. I have converged to these 
scripts after examining all recent ADMB releases for Windows and Linux. 
I copy my scripts into the ADMB bin folder, and ignore other *.bat 
scripts there.

If you like "safe" mode, remove -DOPT_LIB and replace ldf1b2o<->ldf1b2s 
and lado<->lads.

The newest scripts have an -lpthread flag with a comment saying that the 
user may not want to use it. This flag has no effect on performance 
(although the executables are not identical) in my benchmarks, so I'm 
not using it.


More information about the Users mailing list