Link to home
Create AccountLog in
Avatar of Software Assemblies
Software AssembliesFlag for United States of America

asked on

Using Visual Studio 6 writing a C program and getting errors

--------------------Configuration: StockCharter - Win32 Release--------------------
Compiling...
StdAfx.cpp
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\objbase.h(435) : error C2664: 'memcmp' : cannot convert parameter 1 from 'const struct _GUID *' to 'void *'
        Conversion loses qualifiers
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\objbase.h(459) : error C2664: 'memcmp' : cannot convert parameter 1 from 'const struct _GUID *' to 'void *'
        Conversion loses qualifiers
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(68) : error C2733: second C linkage of overloaded function '_memccpy' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(68) : see declaration of '_memccpy'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(69) : error C2733: second C linkage of overloaded function 'memchr' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(69) : see declaration of 'memchr'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(70) : error C2733: second C linkage of overloaded function '_memicmp' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(70) : see declaration of '_memicmp'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(76) : error C2733: second C linkage of overloaded function 'memcmp' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(76) : see declaration of 'memcmp'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(77) : error C2733: second C linkage of overloaded function 'memcpy' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(77) : see declaration of 'memcpy'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(85) : error C2733: second C linkage of overloaded function 'memccpy' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(85) : see declaration of 'memccpy'
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(86) : error C2733: second C linkage of overloaded function 'memicmp' not allowed
        C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\memory.h(86) : see declaration of 'memicmp'
Error executing cl.exe.
Creating browse info file...

StockCharter.exe - 9 error(s), 0 warning(s)
Avatar of evilrix
evilrix
Flag of United Kingdom of Great Britain and Northern Ireland image

Let's start with the obvious errors and see where we go from there.

C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\objbase.h(435) : error C2664: 'memcmp' : cannot convert parameter 1 from 'const struct _GUID *' to 'void *'
        Conversion loses qualifiers
C:\Program Files (x86)\Microsoft Visual Studio\VC98\INCLUDE\objbase.h(459) : error C2664: 'memcmp' : cannot convert parameter 1 from 'const struct _GUID *' to 'void *

This error suggests you have a mismatched with constness. Have you looked at this to see why?

Also, seeing the code would help.
Avatar of Software Assemblies

ASKER

how would I solve this issue?
if this is C program why is it picking up C++ errors?
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
by the way vs 6 is from 1998 and was released before first c++ standard (c++98). if you want to have a c program, you much better would use visual studio 2017 community which is 19 years younger and for free. it still has an excellent ansi-c compiler.

Sara
>> if this is C program why is it picking up C++ errors?
Why do you think they are C++ errors?

>> how would I solve this issue?
Well, you have a const/non-const mismatch and so you'll either have to make one argument const or the other non-const. Without being able to see the code (as I've asked you to provide), we can't really say much more without resorting to telepathy or asking our spirit guides. :)
Why do you think they are C++ errors?

stdafx.cpp is a wizard-generated c++ source which has only one (include) statement: #include "stdafx.h"

the extension .cpp is a reasonable indication that stdafx.cpp is compiled by using the c++ compiler. nevertheless vs studio settings would allow to compile even a source named stdafx.cpp with ansi-c compiler if all headers included by stdafx.h can be included as c headers as well. however, this can't work if the generated stdafx.h source included headers with some inline functions which are not compliant with strict ansi c syntax.

Sara