Sponsored Content
Full Discussion: Organizing C++ Code
Top Forums Programming Organizing C++ Code Post 302561933 by kristinu on Wednesday 5th of October 2011 02:39:59 PM
Old 10-05-2011
In most of my classes I have both a .h and a .cpp, with some inline functions in the .h file as well. One reason I was thinking of keeping the .cpp and corresponding .h files together in same directory. For templates, the declaration and implementation are all in one file as usual.

---------- Post updated at 01:39 PM ---------- Previous update was at 01:26 PM ----------

I had something like this

Code:
#
#  TOMMY - Makefile

#  -History---------------------------------------------------------------
#
#  V01 - DEC 1999 - Luca D'Auria
#        Initial release.
#  V02 - SEP 2008 - Luca Elia
#        Version fixed for g++ 4.3.0.
#        The following settings make it compile without warnings using:
#           g++ (GCC) 3.4.5 (mingw-vista special r3)
#           g++ (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)
#           g++ (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
#           g++ (GCC) 4.3.0 20080305 (alpha-testing) mingw-20080502
#        The -enable-auto-import bit is needed on some newer gcc version.
#        Enable optimizations and disable debug checks so that the final
#        executable can run faster (up to twice as fast).
#  V03 - NOV 2008 - Christopher Dimech
#        Code restructuring.
#
#  -----------------------------------------------------------------------

# GNU Compiler flags

C++ = g++
OPT = -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG
DEF = -DREAL=float -DGetREAL=Getfloat

# OPT = -traditional -Wno-non-template-friend -Wno-deprecated -O3 -DNDEBUG
#       -enable-auto-import

# DEF = -DREAL=double -DGetREAL=Getdouble

# Directories

B = ./baseLib
T = ./tommy
O = ./others
IDIR = -IbaseLib -Itommy -Iothers

all : raytrac tdarwin tsimplex getvel getpdf getmisf tracepdf

# TOMMY files

raytrac : $(T)/RayTrac.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/RayTrac.cc -o raytrac
    -mv raytrac ./bin

tdarwin : $(T)/Tdarwin.cc baselib tommylib
      $(C++) $(OPT) $(DEF) $(IDIR) $(T)/Tdarwin.cc -o tdarwin
    -mv tdarwin ./bin

tsimplex : $(T)/Tsimplex.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/Tsimplex.cc -o tsimplex
    -mv tsimplex ./bin

getvel : $(T)/Getvel.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/Getvel.cc -o getvel
    -mv getvel ./bin

getpdf : $(T)/GetPDF.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/GetPDF.cc -o getpdf
    -mv getpdf ./bin

getmisf : $(T)/Getmisf.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/Getmisf.cc -o getmisf
    -mv getmisf ./bin

rdt : $(T)/Rdt.cc
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/Rdt.cc -o rdt
    -mv rdt ./bin

tracepdf : $(T)/TracePDF.cc baselib tommylib
    $(C++) $(OPT) $(DEF) $(IDIR) $(T)/TracePDF.cc -o tracepdf
    -mv tracepdf ./bin

# Libraries

baselib : $(B)/vect.h $(B)/vector.h $(B)/matrix.h $(B)/dynstr.h $(B)/sstring.h

tommylib : $(T)/layer.h $(T)/linlay.h $(T)/velmod.h

##########################################################################

 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help organizing a music directory with sub directories.

Hello all, I used to have a great script and I lost it :( What the script did was searched a directory named say "music" It searched all sub directories for .mp3 files Then placeed all the .mp3's into a directory of the band name It also renamed the .mps "track#, band name, album name" (I... (9 Replies)
Discussion started by: komputersman
9 Replies

2. Shell Programming and Scripting

Organizing a log

I have a bunch of log files generated from a shell script, its all of my facebook friends and if theyre logged in. Each file is a different person. It runs every 5 minutes. The log file is just the date and time, then 1 if theyre logged in or 0 if theyre not. part of one of the files is: Mon Aug... (5 Replies)
Discussion started by: killer54291
5 Replies

3. Shell Programming and Scripting

Organizing Files

Hi, I'm fairly new at scripting. I need to write a script that takes files from a source directory puts them in a target directory and sorts them by artist name. This is what I have so far #!/bin/bash source_dir='/home/tcindy/songs' target_dir='/home/tcindy/music' for path in... (2 Replies)
Discussion started by: tcindy
2 Replies

4. Shell Programming and Scripting

Organizing log

Hello, Following are the log of my sms application COMMAND: #tail -30 /var/log/smsd.log | grep Message_id | awk '{print $1,$2,$9}' OUTPUT: 2011-02-21 12:16:20,5, 03218975857, 2011-02-21 12:16:26,5, 03323048252, 2011-02-21 12:16:53,5, 03323048252, 2011-02-21 12:16:59,5,... (1 Reply)
Discussion started by: telnor
1 Replies

5. Shell Programming and Scripting

help with organizing some non regular text

hey im trying to get the hex diffrences in two files ones called new and the other is named old i want it to phrase into my script, heres how i need the info: input='\x'94 #the new 1 byte hex change offset=00000000 #the 1st offset of the difference patch unset input offset input='\x'34... (5 Replies)
Discussion started by: lewisdenny
5 Replies

6. Shell Programming and Scripting

Organizing text file by Capital Names (capital word ' ' capital word)

Hi I have a file passwd_exmpl that contains: root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync... (5 Replies)
Discussion started by: eladage
5 Replies

7. Shell Programming and Scripting

Please help me in organizing the data in UNIX

I have an output file in the form Hostname Value1=abc Value2=def Value3=xyz Hostname1 Value1=abc1 Value2=def1 Value3=xyz1 Hostname2 Value1=abc2 Value2=def2 Value3=xyz2 | | | And so on….. I need to export this output into csv so then it should be in format (8 Replies)
Discussion started by: rahul2662
8 Replies
GJAVAH(1)								GNU								 GJAVAH(1)

NAME
gjavah - - generate header files from Java class files SYNOPSIS
gjavah ... DESCRIPTION
The gjavah program is used to generate header files from class files. It can generate both CNI and JNI header files, as well as stub implementation files which can be used as a basis for implementing the required native methods. OPTIONS
-d DIR Set output directory. -o FILE Set output file (only one of -d or -o may be used). -cmdfile FILE Read command file. -all DIR Operate on all class files under directory DIR. -stubs Emit stub implementation. -jni Emit JNI stubs or header (default). -cni Emit CNI stubs or header (default JNI). -verbose Set verbose mode. -force Output files should always be written. Class path options: -classpath PATH Set the class path. -IDIR Add directory to class path. -bootclasspath PATH Set the boot class path. -extdirs PATH Set the extension directory path. Standard options: -help Print help text, then exit. -version Print version number, then exit. -JOPTION Pass argument to the Java runtime. BUGS
SEE ALSO
javac(1), ... AUTHOR
0.98 2010-07-05 GJAVAH(1)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy