Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

So Close.. At least I think?:)

Status
Not open for further replies.

jamez05

Programmer
Jul 29, 2005
130
US
I'm new to C++ and programming in general. My first task was to convert an old C based program to C++.

The program contains about 18 or so include files. I've fixed all of the compile errors except the following:

[C++Error] resmi.cpp(27): Body has already been defined for function 'resmi(char *,int)'.
[C++Error] resmi.cpp(27): VIRDEF name conflict for 'resmi(char *,int)'.

I believe this has something to do with the way the files are included. The main page declares the following prototype:
void resmi(char *,int);
later in the code it calls
resmi(redone,SMLN);

Here's the beginning or resmi.cpp/

void resmi (char *smil,int smilen)
{

This is where the error is happening , specifically it highlights the line the curly bracket is on. Does anyone have any ideas or advice on what the problem is?
 
Check if resmi( char*, int ) is defined anywhere else.
 
If searching for another definition of resmi turns up nothing, make sure nothing "includes" resmi.cpp.

Suggest you put the declaration of resmi in a header file resmi.h, and include that header in resmi.ccp and anywhere else you are calling resmi() from.
 
jamez,

Don't forget that if you put this in a .h file and include it in other .h or .cpp files that this .h file does what all other .h files do. Use the #ifndef .. #end if directive. This says that if resmi is not defined it will define it then include it in the file. If it was previously defined, it will skip it. Look at any .h file int he include directory for your particular IDE or workspace.

HyperEngineer
If it ain't broke, it probably needs improvement.
 
HyperEngineer,

That would apply to class definitions, or inlined functions actually defined in the header.

So far this looks like a global function declared only in the header, defined in the cpp.

Jeb
\0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top