LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices

Reply
 
Search this Thread
Old 08-09-2010, 04:57 AM   #16
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15

thanks for u r reply i tried the above things and it is displayin the following

for this

#include <cv.h>
#include <highgui.h>
int main( int argc, char** argv )
{

IplImage *image;

image= cvLoadImage("home/badri/Desktop/proj/user.jpg");

cvShowImage( "image" );
cvWaitKey(0);


cvReleaseImage(&image);
return 0;
}

output:

badri@linuxmint ~/Desktop/proj $ gcc sample3.c -o out
sample3.c:1:16: error: cv.h: No such file or directory
sample3.c:2:21: error: highgui.h: No such file or directory
sample3.c: In function ‘main’:
sample3.c:6: error: ‘IplImage’ undeclared (first use in this function)
sample3.c:6: error: (Each undeclared identifier is reported only once
sample3.c:6: error: for each function it appears in.)
sample3.c:6: error: ‘image’ undeclared (first use in this function)

for this programme:

#include <stdio.h>

int main (int argc, char *argv[]){
FILE *fp;
int nchars, nwords, nlines;
int lastnblank; /* 0 iff the last character was a space */
char c;

if(argc!=2){
printf("Usage: %s home/badri/Desktop/proj/user.jpg", argv[0]);
exit(0);
}
if((fp=fopen(argv[1],"r"))==NULL){
perror("fopen");
exit(0);
}
nchars=nwords=nlines=lastnblank=0;
while((c=getc(fp))!=EOF){
nchars++;
if (c=='n'){
if (lastnblank)
nwords++;
printf("words=%d, characters=%dn", nwords, nchars);
nchars=nwords=lastnblank=0;
nlines++;
}else{
if (((c==' ')||(c=='t'))&(lastnblank))
nwords++;
lastnblank=((c!=' ')&&(c!='t'));
}
}
printf("lines=%dn", nlines);
fclose(fp);
}

output:

badri@linuxmint ~/Desktop/proj $ gcc sample2.c -o out -ljpeg
sample2.c: In function ‘main’:
sample2.c:11: warning: incompatible implicit declaration of built-in function ‘exit’
sample2.c:15: warning: incompatible implicit declaration of built-in function ‘exit’
 
Old 08-09-2010, 05:47 AM   #17
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,083

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
Quote:
Originally Posted by estabroo View Post
you need to #include <stdlib.h> to get the prototype for exit
So far as I can tell, badriinvenkat ignored that answer and reposted the same warning messages.

Quote:
Originally Posted by badriinvenkat View Post
for this

#include <cv.h>
#include <highgui.h>
1) Learn how to use CODE tags, so you can post readable code samples.

2) I assume you downloaded something that you used as a basis for that code. You shouldn't expect us to recognize OpenCV code. Instead you should post the URL that gave you the information that you misunderstood to produce that code.

3) To use OpenCV, you need to install libraries for OpenCV. It is best to install those through your distribution's package manager. You use Mint, right? I don't have easy access to the package info for Mint, so I checked packages.ubuntu.com, which probably has the same package names you need for Mint. I also haven't used OpenCV, so I'm not sure exactly which packages you need. But I think you need some or all of these packages:
opencv-doc
libcv4
libhighgui4
libcvaux4
libcv-dev
libcvaux-dev
libhighgui-dev

Quote:
cvShowImage( "image" );
I've never used OpenCV, but from a quick web search it appears you can't use cvShowImage that way. You need to specify both the window and the image and I think you need to have created the window in a previous call before you do the cvShowImage.

Last edited by johnsfine; 08-09-2010 at 05:53 AM.
 
1 members found this post helpful.
Old 08-09-2010, 12:46 PM   #18
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
i am sorry friends if i did any mistakes, i am not so good in coding so i posted all the code with the errors, thanks for your suggestions, i will try all the given possible solutions and i never ignored your solutions mate
 
Old 08-09-2010, 05:10 PM   #19
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
Programme:

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[]){
FILE *fp;
int nchars, nwords, nlines;
int lastnblank; /* 0 iff the last character was a space */
char c;

if(argc!=2){
printf("Usage: %s home/badri/Desktop/proj/user.jpg", argv[0]);
exit(0);
}
if((fp=fopen(argv[1],"r"))==NULL){
perror("fopen");
exit(0);
}
nchars=nwords=nlines=lastnblank=0;
while((c=getc(fp))!=EOF){
nchars++;
if (c=='n'){
if (lastnblank)
nwords++;
printf("words=%d, characters=%dn", nwords, nchars);
nchars=nwords=lastnblank=0;
nlines++;
}else{
if (((c==' ')||(c=='t'))&(lastnblank))
nwords++;
lastnblank=((c!=' ')&&(c!='t'));
}
}
printf("lines=%dn", nlines);
fclose(fp);
}


Result:

badri@linuxmint ~/Desktop/proj $ gcc sample2.c -o out -ljpeg
badri@linuxmint ~/Desktop/proj $ ./out
Usage: ./out home/badri/Desktop/proj/user.jpgbadri@linuxmint ~/Desktop/proj $

not displaying the output
 
Old 08-09-2010, 06:20 PM   #20
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,083

Rep: Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110Reputation: 1110
Part of your code is:

Code:
  if(argc!=2){
Do you have any idea what the purpose of that line of code is?

If you do, then you should have no trouble understanding the output you just asked about.

If you don't, then why are you putting code in your programs whose purpose you don't understand?

Start learning with programs simple enough that you actually understand the purpose of each line of code.

Edit: Just so you don't misunderstand. There is nothing wrong with that line of code. You copied from some correct program. What is wrong is not knowing what the code you are writing is supposed to do.

Last edited by johnsfine; 08-09-2010 at 06:22 PM.
 
1 members found this post helpful.
Old 08-13-2010, 04:28 AM   #21
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
thank u so much...any way i completed this task.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thanks to this forum for solving wireless problem barnet1 LinuxQuestions.org Member Intro 1 04-26-2008 03:39 PM
I have a problem solving addiction dohpaz General 8 05-25-2007 12:27 PM
Need help solving this internet problem Please banner Linux - General 7 06-28-2005 06:44 PM
Best language for numerical problem solving? halfhaggis Programming 3 05-26-2004 02:11 AM
Partition problem solving... true_atlantis Linux - General 5 10-30-2003 12:16 PM


All times are GMT -5. The time now is 02:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration