LinuxQuestions.org
Help answer threads with 0 replies.
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 11-28-2006, 02:12 PM   #1
hedpe
Member
 
Registered: Jan 2005
Location: Boston, MA
Distribution: Debian
Posts: 380

Rep: Reputation: 30
how to turn off ansi C++ when compiling?


Hi,

I am getting these errors when trying to compile a specific extern "C" section of code with g++ to link it with a larger C++ project.

How can i turn off ANSI C++ during compilation to avoid this?

Code:
g++ -W -Wall -fno-exceptions -fno-rtti  -DHAVE_CONFIG_H -I../include -I../include -I. -I..  -DCLICK_USERLEVEL -g -O2 -MD -c ../elements/local/adddf3.cc
../elements/local/adddf3.cc: In function `DFtype __adddf3(DFtype, DFtype)':
../elements/local/adddf3.cc:33: warning: left shift count is negative
../elements/local/adddf3.cc:34: warning: left shift count is negative
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: left shift count is negative
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: left shift count >= width of type
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: left shift count >= width of type
../elements/local/adddf3.cc:35: warning: left shift count is negative
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: right shift count is negative
../elements/local/adddf3.cc:35: warning: left shift count is negative
../elements/local/adddf3.cc:36: warning: right shift count is negative
../elements/local/adddf3.cc:35: error: ISO C++ forbids cast to non-reference type used as lvalue
../elements/local/adddf3.cc:35: error: ISO C++ forbids cast to non-reference type used as lvalue
Thanks!
George
 
Old 11-28-2006, 02:22 PM   #2
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 60
Quote:
../elements/local/adddf3.cc:35: error: ISO C++ forbids cast to non-reference type used as lvalue
i dont know the answer to your specific question but can you just edit the source to fix this? if you pass an option to g++ to Ignore this error then the program may have a bug and unexpected results.
 
Old 11-28-2006, 04:22 PM   #3
grezly
Member
 
Registered: May 2006
Distribution: Slackware
Posts: 46

Rep: Reputation: 15
Normally it isn't a good idea to compile with less arguments.
But the one you maybe looking for is '-Wall'.
That switch shows all the warnings that will occur meanwhile compiling.
 
Old 11-28-2006, 10:30 PM   #4
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
it's been a long time so forgive if i get this wrong but there is a way to deal with this.
i think you can just make your function a non member of your class.
declare it in the .hh file at the bottom outside of the class definition and then just put it in the .cc file as a function without a class just like it would be if you wer writing in c.
 
  


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
How to start, stop, turn on, and turn off deamons BuckRogers01 Debian 3 08-16-2005 09:39 AM
How to turn off Xserver in the gui and turn it off in the command line geminiviper Linux - Newbie 8 08-20-2004 08:05 AM
Ansi Telnet thebutler4 Linux - Software 1 05-25-2004 12:58 PM
Is this ansi-c compliant? xailer Programming 5 12-26-2003 08:49 PM
ANSI C Manual rajaram Programming 6 01-05-2002 07:39 PM

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

All times are GMT -5. The time now is 12:50 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