English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 16 June 2002, 17:45   #1
dcr8520
 
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 ;)
 
Old 16 June 2002, 18:18   #2
Drake1009
Registered User
 
Drake1009's Avatar
 
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.
Drake1009 is offline  
Old 16 June 2002, 18:39   #3
§ane
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);
}
§ane is offline  
Old 16 June 2002, 22:01   #4
dcr8520
 
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?...
 
Old 16 June 2002, 22:34   #5
§ane
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.
§ane is offline  
Old 18 June 2002, 06:31   #6
dcr8520
 
Posts: n/a
Well..well... I fix the problem with a single line: #include <g++/iostdio.h> :-)


regards & thx ;)
 
Old 18 June 2002, 08:41   #7
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,700
That's not a C problem, it's a C++ problem...
Minuous is offline  
Old 05 July 2002, 20:53   #8
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Arrow

Just try to REMOVE the -ansi option from the gcc command line, probably in your makefile.
It might work then.
andreas is offline  
Old 06 July 2002, 16:33   #9
dcr8520
 
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

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

Forum Jump


All times are GMT +2. The time now is 01:39.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.07661 seconds with 13 queries