LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-12-2007, 09:43 PM   #1
jabbertrex
LQ Newbie
 
Registered: Apr 2007
Posts: 6

Rep: Reputation: 0
newbie Q: ubuntu build-essentila argv problem


I installed Ubuntu and installed the build-essential package using Symantec Package Manager

When I write a simple C program, one compies and the other gives error

Example I: works fine
#include <stdio.h>
int main(argc, char *argv[])
{
printf("# of args %d \n", argc);
}

Example II: gives error in compile
#include <stdio.h>
int main(argc, char *argv[])
{
printf("# of args: %d, 1st arg: %s\n", argc, argv[0]);
}

Example 2 gives me error: argv undeclared (first use in the function)

I am using Ubuntu gcc 4.0.2 20050808 prerelease version that came with the book.

This is a very simple program. Why I am getting argv undeclared error.

Thanks,
Jay

Last edited by jabbertrex; 04-12-2007 at 09:50 PM.
 
Old 04-13-2007, 03:02 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
I don’t see why you leave off the type of argc and frankly don’t understand why it compiles correctly in the first scenario. Try
Code:
int main(int argc, char *argv[])
instead of
Code:
int main(argc, char *argv[])
 
  


Reply



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
LXer: Build Your Own Ubuntu LXer Syndicated Linux News 0 02-06-2007 02:33 PM
Build of wxwindows ubuntu 6.10 windsurfer Linux - Software 3 01-17-2007 07:17 AM
Newbie attempting build of sane on Ubuntu, gets errors treader Linux - Newbie 5 04-01-2006 04:36 PM
Ubuntu newbie, problem accessing harddisks comradesniper Ubuntu 5 03-27-2006 09:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration