Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 10-23-2004, 07:15 PM   #1
LQ Newbie
Registered: Oct 2004
Posts: 2

Rep: Reputation: 0
gcc: invalid operands

I'm trying to compile some textbook code and gcc is being a pain in the ass.

It says "invalid operands" for lines that contain something like

scanf("%d%d", &a, &b);

I've decided that it must have to do with the character set with which I'm working, because simple text files will sometimes work without a problem.

I'd like to be able to use KWrite or something visually appealing like that.

Is there an option for gcc that would allow me to process source code in say, ISO-8859-1 format?

Old 10-25-2004, 08:31 AM   #2
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
Try having a look at the manual page (man gcc). Be warned, there's a lot of it.

Are you sure the code there is exactly as in the textbook though, and there isn't a space or something between the two %d's though? 'Cause as it is, what you're asking the system to read is two integers, with nothing between them? So how does it know where one number ends and another starts.

For example, given the input 123, is this 12, then 3, or 1, then 23?
Of course, it is possible that I'm on completely the wrong track here.

Just to clarify, what do you mean when you say "simple text files will sometimes work without a problem"?

Anyway, I hope this helps you.


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 03:13 PM
what does "prog7.c:11: error: invalid operands to binary %" mean hubabuba Programming 6 11-16-2004 12:13 PM
squirremail says invalid user or invalid password. rnj Fedora 9 10-25-2004 10:56 PM
invalid module format on kernel 2.6.6 using gcc 3.3 oh_me Linux - Software 0 05-20-2004 10:48 AM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 01:07 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:50 PM.

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