16 June 2002, 17:45 | #1 |
Posts: n/a
|
a C problem
Im use gcc 2.95.3, and compiling some gnu sources I get this error:
debug.c: In method `void CDebugLog::log(const char *, ...)': debug.c:206: ANSI C++ forbids implicit conversion from `void *' in argument passing this line have: vfprintf( m_debugFile, format, args ); can someone help me please? regards ps: excuse my ignorance ;) |
16 June 2002, 18:18 | #2 |
Registered User
Join Date: Jul 2001
Location: Denmark
Posts: 2,284
|
I don't know what the error is, but I recall a lot of documentation for various programs under Linux warning you against using a certain version of gcc and above since they claim there are errors in these.
|
16 June 2002, 18:39 | #3 |
Registered User
Join Date: Jul 2001
Location: .
Age: 44
Posts: 246
|
/*
We really need to see more of your code, exactly which line is failing? vfprintf( m_debugFile, format, args ); // what relation does this have to CDebugLog::log()? Possibly one of your arguments to log() are type void* and log() requires a pointer to const char This is an example of using vprintf() to output a variable list of parameters to the stdout, it should work equally well for vfprintf() */ #include <stdio.h> #include <stdarg.h> void examplelog(const char *string, ...) { va_list arg_ptr; va_start(arg_ptr, string); vprintf(string, arg_ptr); va_end(arg_ptr); } void main(void) { const char firststring[] = "I liek"; const char secondstring[] = "milk"; examplelog("%s %s!!\n", firststring, secondstring); } |
16 June 2002, 22:01 | #4 |
Posts: n/a
|
This is the entire function from debug.c:
/** * Show a tracing string (line 175 */ void CDebugLog::log( const char *format, ...) { if ( !m_tracingEnabled ) { return; } if ( m_debugFile == NULL ) { return; } /* Wait until we can safely write. */ m_mutex->lock(); if ( m_timeStamping ) { printTimeStamp(); } va_list args; va_start(args, format); pthread_t self = pthread_self(); /* Write the thread ID first.. */ fprintf( m_debugFile, "%d ", (int)self ); /* Then the message. */ vfprintf( m_debugFile, format, args ); /* Flush the logfile. */ fflush( m_debugFile ); va_end(args); /* Release our mutex. */ m_mutex->unlock(); } if I change vfprintf() to vprintf() the error was: debug.c: In method `void CDebugLog::log(const char *, ...)': debug.c:206: passing `FILE *' as argument 1 of `vprintf(const char *, char *)' ...¿?... regards ps: Drake1009: I dont understand very well, my english is not good, you have docs about solves to linux srcs means?... |
16 June 2002, 22:34 | #5 |
Registered User
Join Date: Jul 2001
Location: .
Age: 44
Posts: 246
|
Well the problem lies elsewhere, not in that function. It's just that it is having trouble interpreting one of the parameters passed to it, CDebugLog::log(), I am referring to.
Also you should not be touching "debug.c" as I believe this is a GNU helper library and not specifically code from the program you are trying to compile. You must look through your application's source for the offending call to CDebugLog::log(), this may require tracing it back a few function calls to figure out why a void pointer is being passed to it. |
18 June 2002, 06:31 | #6 |
Posts: n/a
|
Well..well... I fix the problem with a single line: #include <g++/iostdio.h> :-)
regards & thx ;) |
18 June 2002, 08:41 | #7 |
Coder/webmaster/gamer
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,700
|
That's not a C problem, it's a C++ problem...
|
05 July 2002, 20:53 | #8 |
Zone Friend
|
Just try to REMOVE the -ansi option from the gcc command line, probably in your makefile.
It might work then. |
06 July 2002, 16:33 | #9 |
Posts: n/a
|
Ok,, thx for your answer :)
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mike the Magic Dragon: in-game problem or WinUAE problem? | petran | support.WinUAE | 33 | 16 August 2023 20:29 |
aspi problem (was: auto resize problem) | Kyon | support.WinUAE | 34 | 31 May 2009 16:56 |
Problem with Kickstarts [rare problem with faulty scripts in early v1.1 release] | Topgun | project.GameBase Amiga | 14 | 08 June 2006 22:19 |
|
|