M
M
Mirinum2019-12-08 19:48:26
OOP
Mirinum, 2019-12-08 19:48:26

How to solve the function prototype error?

Help, please
I registered a function prototype for combining lists in the header file, I wrote the function itself in a separate cpp file
Two lists must be passed to the function, and, apparently (List & L1, List & L2) does not work
I declare the structure of the list in the header, but it also connected to a file with a function, so I can't understand why it gives an error
Here is the code
https://github.com/Mirinum/laba8
Here are the errors
'List' was not declared in this scope
'L1' was not declared in this scope
'List' was not declared in this scope
'L2' was not declared in this scope
expression list treated as compound expression in initializer [-fpermissive]
expected ',' or ';' before'
'int merge(List&, List&)' redeclared as different kind of symbol
previous declaration of 'int merge'
'merge' cannot be used as a function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2019-12-08
@Mirinum

The header file func1.h should describe the prototypes of classes and functions.
Write the implementation in the func1.cpp file.
In the main.cpp file include only the func1.h header file.
PS. In default structs, all methods are public, the public keyword is not required.
PS2. Why are you using structs and not classes?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question