Menu

C Code Warnings Cause Havoc

2002-09-15
2012-09-26
  • Nobody/Anonymous

    I'm trying to use a C library in my C++ Project. The C library is PhysFS (a cross platform file management lib). But whenever I try to compile the PhysFS code I'll get warnings.  Like this:

    [Warning] In function `int appendDirSep(char **)':
    320 ANSI C++ forbids implicit conversion from `void *' in assignment

    Now I don't really care so much about warnings but the problem is that the code still won't compile, I'll get an error like this at the end of my compiler output:

    physfs.o: No such file or directory.

    Does that make any sense? There weren't any errors? Now I know you're probably ready to blame PhysFS but I've seen this sort of problem happen before with other C libraries. Does anybody know why this is happening, and how to fix it without having to rewrite the lib itself.

     
    • Nobody/Anonymous

      Problem is your library is using the implicit conversion from void to other types. Ansi C++ does not like this and the G++ compiler is bombing out at the warning. I believe there is an option to continue to compile on warnings but I do not know what it is.

      The alternative is to use C only. Obviously this option is valid if you are not using C++ language structures.

      Try changing the file extensions from .CPP to .C. Also make sure all C++ options are switched off in DEV-C++.

      Let me know if it helps.

      BlakJak :]

       
    • Nobody/Anonymous

      Try playing with the compiler Options, like "Inhibit al Warning messages". Maybe that will help....

      stephan

       
    • Nobody/Anonymous

      Yeah thats what I've been doing (messing with various compiler flags), As far as .cpp and .c goes all the C++ parts of my project have .cpp extensions and C parts have .c extensions.

      I've come up with a few quick fixes but I'd still much rather compile the C and C++ parts together in one big lumpy project.

      The fix: Just stash all the C parts off into a seperate project compile it as a static (or dynamic) lib, and then link it to the C++ parts. Thankfully I can get away with doing this C parts don't use the C++ parts.

      But still if you know whats going on with those ca-razzy warnings let me know.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.