LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-20-2012, 02:32 PM   #1
ezekieldas
Member
 
Registered: Mar 2010
Posts: 122

Rep: Reputation: 16
C - make - error: extra qualification ‘ctrace::’ on member ‘ctrace’


Hi --My C was never that great but at one time I was able to hack through issues like this. That was many years ago and today I'm feeling fairly clueless about what to do with this. My questions:

1) Is there an option to tell make to ignore this sort of error?
2) If you look at trace.h (attached) there's a comment about two ctraces but only one is
used. Could this be a matter of enabling/disabling one? There's no comment about how that might be done.

This code is from: http://snarfed.org/synchronizing_mp3_playback


Code:
#p4sync-0.1> make

g++  -I. -fPIC -g -Wall  -DVERSION=\"0.1\"  -c -o client.o client.cpp
player.h:36: warning: ‘class cplayer’ has virtual functions but non-virtual destructor
trace.h:101: error: extra qualification ‘ctrace::’ on member ‘ctrace’
make: *** [client.o] Error 1
Attached Files
File Type: txt trace.h.txt (7.4 KB, 10 views)

Last edited by ezekieldas; 11-20-2012 at 02:34 PM.
 
Old 11-20-2012, 02:39 PM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,107

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
The warning on line 36 of player.h is a somewhat bogus warning. There is little correlation between the situation the compiler is complaining about and the run time bug that the compiler writers think they are helping you avoid.

The error on line 101 of trace.h is more serious, but easy to fix.

Part of the code on that line says ctrace::ctrace when it is supposed to say just ctrace

I haven't tried to find the source code. I am going entirely by the error message you quoted. If you are confused or you think I might be guessing incorrectly (which I think is unlikely) please post several lines of code from trace.h around line 101 and highlight which line exactly is line 101. Then someone could verify what I said you should change on that line.

The actual error in the code is an incorrect C++ syntax that used to be very common in C++ source code. GCC has gradually gotten stricter from version to version, old gcc just ignored the syntax error because the compiler knows what the code is supposed to mean, later gcc versions warned about that error and went on to compile the code anyway. Now (at least with the settings you used) it insists you fix that syntax error.

Quote:
Originally Posted by ezekieldas View Post
1) Is there an option to tell make to ignore this sort of error?
I'm pretty sure there is an option to gcc to convert that error back to a warning. But I neither know the option nor how to get make to pass that option to gcc. It should be easier to just fix trace.h

Quote:
2) If you look at trace.h (attached) there's a comment about two ctraces but only one is
I don't see an attached file. I see a link to a blog and no obvious way to get trace.h from there. I didn't want to dig that much to get a line of code you should have quoted.

So I can't guess your meaning regarding "comment about two ctraces". I'm pretty sure line 101 has ctrace::ctrace where the correct C++ syntax is just ctrace

Edit: There seems to have been some lag between when you edited to add the attached file and when I got to see it. Anyway, now I see it. There is a line that looks like
Code:
  ctrace::ctrace() : out(cerr) {}
but is supposed to be
Code:
  ctrace() : out(cerr) {}
(exactly as I said before I even saw it)

The syntax of the original line is required/correct only if the line appears outside of the class definition and is defining a constructor that, inside the class definition, was declared but not defined.

The syntax without the extra ctrace:: is required/correct when declaring (or both declaring and defining) the constructor inside the class definition.

Last edited by johnsfine; 11-20-2012 at 03:02 PM.
 
Old 11-20-2012, 06:22 PM   #3
ezekieldas
Member
 
Registered: Mar 2010
Posts: 122

Original Poster
Rep: Reputation: 16
Hey thanks --this was really helpful. I managed to make the change which allowed the compilation to proceed a bit further. This is maybe a different question but what I'm looking at now is:

Code:
# p4sync-0.1> make

g++  -I. -fPIC -g -Wall  -DVERSION=\"0.1\"  -c -o client.o client.cpp
player.h:36: warning: ‘class cplayer’ has virtual functions but non-virtual destructor
g++  -I. -fPIC -g -Wall  -DVERSION=\"0.1\"  -c -o player.o player.cpp
player.h:36: warning: ‘class cplayer’ has virtual functions but non-virtual destructor
player.cpp: In member function ‘void cplayer::plugin_enabled()’:
player.cpp:44: error: ‘assert’ was not declared in this scope
player.cpp: In member function ‘void cplayer::plugin_disabled()’:
player.cpp:74: error: ‘assert’ was not declared in this scope
make: *** [player.o] Error 1
I am not sure how to do this scope declaration properly. I've attached player.cpp here.


Thank you!
Attached Files
File Type: txt player.cpp.txt (4.1 KB, 9 views)
 
Old 11-21-2012, 03:09 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,947

Rep: Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602Reputation: 2602
"p4sync" : The code was edited 2 hours ago ?
https://github.com/snarfed/p4sync
1) $ git clone https://github.com/snarfed/p4sync.git
2) $ cd p4sync/ && make : No errors, no warnings.

May be you got an old version ? "p4sync-0.1" ?
 
Old 11-21-2012, 04:08 AM   #5
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,290

Rep: Reputation: 174Reputation: 174
It is not make giving you a warning, it is gnu c++

It is usually better to fix the warning rather than take the bulb out, but
you can turn them off,

If you do man g++ and search for 'Warn' you will find a load of warnings you can tailor.


I often do -Wno-parentheses
If you do a 'no' warning it needs to come after a -Wall otherwise obviously it
will be toggled back on.
 
Old 11-21-2012, 04:27 AM   #6
pan64
Senior Member
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 4,929

Rep: Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306Reputation: 1306
you can check if assert.h included somewhere, probably it is missing. Otherwise you can comment out both lines in player.cpp
 
Old 11-21-2012, 06:40 AM   #7
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,107

Rep: Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114Reputation: 1114
pan64 gave the answer I would have given if I saw your question earlier (the assert lines can be left out without damaging the program, or the proper #include could be added near the top of the .cpp file to declare assert).

But I think knudfl's answer might be better. If I understand correctly, knudfl is telling you how to get a newer version of the source code that doesn't have these problems.
 
  


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
Kernel make error: no member named ‘wireless_handlers’ XXLRay Linux - Kernel 0 11-24-2010 12:29 AM
error: ‘libintl_snprintf’ is not a member of ‘std’ make: *** [image.o] Error 1 mmateen Linux - Hardware 0 08-13-2009 11:47 AM
RHCE qualification Shagbag Linux - Certification 2 11-15-2008 06:55 PM
How can I make this extra partition user-accessable? enigma Z Linux - Hardware 2 09-05-2004 10:09 PM


All times are GMT -5. The time now is 10:14 PM.

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