LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-04-2008, 03:34 PM   #1
babag
Member
 
Registered: Aug 2003
Posts: 419

Rep: Reputation: 31
c++ getting error


getting the following error compiling c++:
Code:
[babag@office disk]$ g++ LMP_Process-20.cpp -g -o LMP_Process
LMP_Process-20.cpp: In function ‘int main()’:
LMP_Process-20.cpp:488: error: expected `)' before ‘!’ token
LMP_Process-20.cpp:490: error: expected `;' before ‘)’ token
here's the offending code:
Code:
		else if ((sensorW / AspectRatio) !< sensorH) {				// Keep height, trim width

			(CropX     = (CtrX - ((sensorH * AspectRatio) / 2))), 	(CropY = 0));
			(CropW     = sensorW),					(CropH = sensorH);
			(CanvasW   = CropW),					(CanvasH = CropH);
			(CanvasPos = "center");

		}
line 488 is the 'else if' line.

the code compiles if i comment this passage out. this is a copied section of code. the only difference in this bit and the original is the '!' in the first line. in other words, one says:
Code:
		else if ((sensorW / AspectRatio) < sensorH) {
and the other says:
Code:
		else if ((sensorW / AspectRatio) !< sensorH) {
any tips appreciated.

thanks,
BabaG
 
Old 07-04-2008, 03:49 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
To my knowledge ‘!<’ is not a valid operator, did you mean not equal, which is ‘!=’.
 
Old 07-04-2008, 03:52 PM   #3
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by harry edwards View Post
To my knowledge ‘!<’ is not a valid operator, did you mean not equal, which is ‘!=’.
!< == >= or !(foo<bar)

Quote:
The message you have entered is too short. Please lengthen your message to at least 10 characters.
Ok I need to post some text

edit: that does not actually say what I wanted (and I could have used || instead of 'or').Yes you are correct that operator is not defined, but you can use the same logic as I posted

babag why are you using so many parentheses and the comma operator?

Last edited by dmail; 07-04-2008 at 04:04 PM.
 
Old 07-04-2008, 04:30 PM   #4
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by dmail View Post
!< == >= or !(foo<bar)
i don't get this. what does it say?
Quote:
Originally Posted by dmail View Post
babag why are you using so many parentheses and the comma operator?
mainly because i only barely know anything about what i'm doing here but it works, everywhere but in this bit.

thanks,
BabaG

Last edited by babag; 07-04-2008 at 04:45 PM.
 
Old 07-04-2008, 05:22 PM   #5
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
Originally Posted by babag View Post
i don't get this. what does it say?
That would be my failed attempt at operator humour then.

What I was saying is that the operator you tried to use is not defined so you can replace your logic using two methods (could use more)

Code:
		else if ((sensorW / AspectRatio) >= sensorH) {

or

		else if ( ! ( (sensorW / AspectRatio) < sensorH) ) {
 
Old 07-04-2008, 11:47 PM   #6
babag
Member
 
Registered: Aug 2003
Posts: 419

Original Poster
Rep: Reputation: 31
Code:
	if ((sensorW / AspectRatio) < sensorH) {				// Keep width, trim height

		(CropX     = 0), 					(CropY = CtrY - ((sensorW / AspectRatio) / 2));
		(CropW     = sensorW),					(CropH = (sensorW / AspectRatio));
		(CanvasW   = CropW),					(CanvasH = CropH);
		(CanvasPos = "center");

	}

	else if ((sensorW / AspectRatio) >= sensorH) {				// Keep height, trim width

		(CropX     = (CtrX - ((sensorH * AspectRatio) / 2))), 	(CropY = 0));
		(CropW     = sensorW),					(CropH = sensorH);
		(CanvasW   = CropW),					(CanvasH = CropH);
		(CanvasPos = "center");

	}
now produces this:
Code:
LMP_Process-20.cpp: In function ‘int main()’:
LMP_Process-20.cpp:490: error: expected `;' before ‘)’ token
in the 'else if' line:
Code:
(CropX     = (CtrX - ((sensorH * AspectRatio) / 2))), 	(CropY = 0));
commenting out the line, the compile works.

EDIT:
ok. this compiled:
Code:
(CropX     = CtrX - ((sensorH * AspectRatio) / 2)),	(CropY = 0);
thanks,
BabaG

Last edited by babag; 07-04-2008 at 11:58 PM.
 
  


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
Putty fatal error: Network error: connection refused (ubunty server 6.06.1) gerardnijboer Ubuntu 2 03-18-2010 03:46 PM
Conmpile error wen compile php:configure: error: libpng.(a|so) not found tanveer Linux - Software 5 02-03-2009 06:13 AM
Suse CUPS error: cups(File)DoRequest error:client-error-bad-request smdonelan Linux - Hardware 6 04-17-2007 06:46 PM
Error message received from system Error while reading filter description for true Steel_J Linux - Software 2 03-04-2006 06:10 PM
updating new installation of 9.3 ERROR...ERROR...ERROR Morbid SUSE / openSUSE 3 08-15-2005 11:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:46 PM.

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