Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1188
  • Last Modified:

how to run program usuing makefile


hi i  have a question on makefile. i have  downloaded a  source code.... lots of  .cc and  .hh files are there and also a makefile is also there. i have heard that usuing makefile i can run the program. how can i do that .... plz give some steps.( i am working  in redhat  linux 7.02) and g++ compiler.

so...

(1) how can i run my program? is that makefile help me to run???... some  scripts are there(in makefile), i cannot understand. if it is runnable plz  tell me what i have to do mechanically ?

(2)i have some .cc files in source code. i  have no idea about .cc extension..... is it the c programs for other operating sytems except windows?????

(3) i want to learn something about makefile also. where can i find some tutorial ( easy and understandable)????

thanks...
0
sanko50
Asked:
sanko50
  • 4
  • 2
  • 2
1 Solution
 
sunnycoderCommented:
Hi sanko50,

1. try typing make at your command prompt .. if that does not work, try make all

2. file.cc
file.cxx
file.cpp
file.C
all refer to C++ source code which must be preprocessed. Note that in `.cxx', the last two letters must both be literally `x'. Likewise, `.C' refers to a literal capital C.
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html#SEC2

3.http://www.gnu.org/manual/make-3.79.1/html_chapter/make_toc.html

Cheers!
Sunny:o)
0
 
sanko50Author Commented:

ok trying......
0
 
Karl Heinz KremerCommented:
Actually, C++ files usually are no longer preprocessed, they just get compiled with a different compiler. C++ used to be preprocessed and converted to C by software like cfront, but these days, all C++ compilers are "real" compilers. The make tool "knows" how to convert the different types of source files to object files. For C files, it will for example use the gcc program, and for C++ files the g++ program. You can actually change which compiler is used in the make file by specifying the CC or CXX variable for C and C++ respectively.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
sanko50Author Commented:

i did that , after writing make  , i got many object files in my directory.... i think it has been succesful..is not it???? but it is not running..... from the readme file i found

Usage: encode [image][width][height][output][ratio]

so i wrote        encode [ lena512.pgm] [512] [512] [output] [ 4:1]


but i got reply   bash:::encode not found ... but encode is in my directory( in a different color...is this color for executables!!!!!!).

LET ME TELL U...... I AM TRYING TO COMPRESS   IMAGE USUING WAVELET TRANSFORMATION.
THAT IS WHY ENCODE IS THERE.

I AM GIVING YOU THE LINK FROM WHERE  I DOWNLOADED..... IS THAT SOURCE CODE WRONG?????(AT LEAST NOT RUNNABLE)

BASICALLY I DONOT KNOW HOW TO RUN USUING MAKEFILE. THIS IS MY FIRST TIME.... I AM DOING JUST FROM  UR COMMENTS.  i read the readme file then i usued
 encode [ lena512.pgm] [512] [512] [output] [ 4:1]
still it is not running..... i think somewhere i have done some mistake  syntactically. i think source code is correct...

i am giving the link
http://www.geoffdavis.net/dartmouth/wavelet/wavelet.html

then downloaded  wavelet.0.3.tar.gz .....then untarred etc etc. then i did  like above steps.

am i wrong  syntactically???? plz have a look on readme file(if possible).
waiting for answer.
NOTE: images are in the image directory. i copied only lena512.pgm  to my directory where all the executables and other headers are there.

thanks

 
 
0
 
sunnycoderCommented:
>encode [ lena512.pgm] [512] [512] [output] [ 4:1]

[] represent optional paramters ... you need to specify them without the []

encode lena512.pgm 512  512 output  4:1

also, >bash:::encode not found
indicates that your current dir is not in your path ... so use

./encode lena512.pgm 512  512 output  4:1
0
 
sanko50Author Commented:


(1) ohh...many many  thanks ..  it is working . i am getting output.... but why there is no file naming output in my directory so that i can view the  compressed output  in a imageviewer software
jasc paint shop pro8.

thanks

(2) why r u saying...

" also, >bash:::encode not found
 indicates that your current dir is not in your path ... so use "

why r u saying  so . let me give u more information also.... i am working through telnet ...as soon as i connected .. i typed pwd.

 it is showing  /home/myname

then i changed to the wave dirrectory where all the supporting files and images and exe (including encode) are there. SITTING ON THAT DIRECTORY  i am giving command  " encode"

then why it  says command not found.( of course i tried  encode lena512.pgm 512  512 output  4:1  also but got  >bash:::encode not found  ) . i did not use   " ./ " that was a mistake. can u say why???

thanks for the above successes also but not getting output file in my directory!!!!!!!!!!!!!!!!!!!!!!. i am getting  some output on the screen also.... but in the readme file it says   "  output: name of compressed image  "


0
 
Karl Heinz KremerCommented:
You search path does not contain the current directory. You can verify this by running
echo $PATH
If you want to include this directory in your path, open the file .bashrc in an editor and add the
following line
export PATH=$PATH:.

When you log in the next time, you should be able to run binaries in the current directory.

You should have a file named "output" in our wave directory. If it's not there, maybe the program did automatically attach an extension, so do a
ls -l output.*
to see if it has an extension.

If you log in via telnet, are you doing this from a X11 enabled machine? If so, you should be able to run an image viewer on the remote machine and display the image on your local machine. I don't know which software is available on your remote machine, but try both "xv" and "display". You may also have access to "gimp".

0
 
sanko50Author Commented:

it is not x11 enabled.... and i am not getting output by   ls -l output.*
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now