This code is giving me this error, which I don’t understand. I can’t even run the program. Can you help me to fix this error, please? If you don’t understand anything in the code, say it.
error C2040: 'CancelarPedido' : 'ppedido (ppedido)' differs in levels of indirection from ‘int ()’
printf("nIntroduza opcao:");
scanf("%d",&opc);
switch(opc){
case 1: lista = NovoPedido(lista);break;
case 2: lista = CancelarPedido(lista);break;
case 3: printf("Falta implementar a funcao.");break;
case 4: printf("Falta implementar a funcao.");break;
}
}while(opc!=5);
return lista;
}
ppedido CancelarPedido(ppedido lista)
{
ppedido actual, anterior = NULL;
char id[5];
actual = lista;
if(lista == NULL)
printf("nNao ha pedidos na fila de espera...");
else
{
printf("nIntroduza o ID do pedido que pretende cancelar: ");
scanf("%s", id);
while(actual != NULL && ((strcmp(actual->id, id)) != 0)){
anterior = actual;
actual = actual->prox;
}
if(actual == NULL){
printf("nERRO - Nao existe nenhum pedido com o ID introduzido.");
return lista;
}
if(anterior == NULL){
lista = actual->prox;
printf("nPedido cancelado com sucesso...");
}
else{
anterior->prox = actual->prox;
printf("nPedido cancelado com sucesso...");
}
free(actual);
return lista;
}
}
Jongware
22k8 gold badges52 silver badges99 bronze badges
asked Jun 23, 2012 at 4:23
8
You are calling CancelarPedido before you declared it. You need to reorder the code or add a forward declaration for CancelarPedido.
Without a declaration of CancelarPedido in scope, it defaults to int CancelarPedido(). You get the error message because lista is declared to be a pointer but CancelarPedido is declared to return an int.
answered Jun 23, 2012 at 4:32
Jim BalterJim Balter
15.9k3 gold badges43 silver badges66 bronze badges
4
-
09-10-2001
#1

the Corvetter
Levels of Indirection???
Every once in a while, I get this same warning message that causes DOS to crash and I don’t know what to do about it. I’ll give you the code, and then the warning:
Code:
#include <stdio.h> char vName[] = "John Smith"; char *const pName = &vName; char vDate[] = "9/10/01"; const char *pDate = &vDate; int main() { printf("Name = %s Date = %s", *pName, *pDate); *pName = "George Washington"; pDate = "6/10/01"; printf("Name = %s Date = %s", *pName, *pDate); return (0); }That’s the code. And the warning message is «‘const char *’ differes in levels of indirection». What exactly would a level of indirection be? Well, this warning is causing the program to crash and it is getting to me. Thanks.
-
09-10-2001
#2

and the hat of int overfl
Well there are quite a few broken indirections in your code.
Code:
char vName[] = "John Smith"; char *const pName = vName; // this is a constant pointer char vDate[] = "9/10/01"; const char *pDate = vDate; // this is a pointer to a constant int main() { printf("Name = %s Date = %s", pName, pDate); pName = "George Washington"; // it's constant, so this assignment is illegal pDate = "6/10/01"; printf("Name = %s Date = %s", pName, pDate); return (0); }> What exactly would a level of indirection be?
It’s a count of how many *’s you have to go through to get to the real data.> Well, this warning is causing the program to crash and it is getting to me.
Fix the code then — this is one of the warnings you shouldn’t be ignoring.
-
09-10-2001
#3

the Corvetter
Well, I have just gotten a reply from another C message board and I think you two have different explanations. He said that I was trying set set a string to a pointer. The array of a pointer, he said, is memory so you can’t set an array of characters to it. He said that I would have to do the strcopy function to put another string into it. Do you agree? I don’t really understand what you are saying.
When you say the level of indirection is «a count of how many *’s you have to go through to get to the real data», what do you mean? Thanks.
-
09-10-2001
#4

the Corvetter
I think I just realized something. When you say the number of *’s to get to the data, you mean the number of pointers, right? So, where was my error? I read that I can change the pointer to a constant string (for example) and that isn’t working with the string, but the constant. Now that I think of it, it doesn’t really make sense.
Take a look at my first post. So, you’re saying if you have:
Code:
const char *pPointer = &vVar;
that I can’t change either the pointer (pPointer = ‘A’) or I can’t change what it points to (*pPointer = ‘A’)? Is there a difference between my two examples (pPointer = ‘A’ and *pPointer = ‘A’)? But if I have this:
Code:
char *const pPointer = &vVar;
then I can legally do the changes (pPointer = ‘A’ and *pPointer = ‘A’) because the const pointer only means that that pointer can only point to that char address, right? Thanks.
-
09-11-2001
#5

and the hat of int overfl
char vName[] = «John Smith»;
char *pPointer = &vName;Ignoring the const for a moment, this code has incompatible types.
An array name by itself (vName) has the same type as a pointer to any element of the array (&vName[x]), and specifically the same value as a pointer to the first element of the array (&vName[0]).
So you would have
char vName[] = «John Smith»;
char *pPointer = vName;The &vName is a pointer to the whole array, not a pointer to the first element (it’s likely to be the same value as a pointer to the first element, but the type is totally different)
To make this valid, you need a different type of pointer
char hello[] = «hello»;
char (*arr)[6] = &hello;
Note that this isn’t an array of 6 pointers to char, its a pointer (singular) to an array of 6 characters.The const keyword can be used as follows
char hello[] = «hello»;
char world[] = «world»
const char *a = hello;
char * const b = hello;a is a pointer to a constant char — this means you can modify a (say a=world), but you can’t modify what a points to (say a[0] = ‘f’ would be illegal).
b is a constant pointer to char — this means you cannot change b, but you can change b[0]
const char * const c = hello;
means you cannot modify c or c[0]> Do you agree?
No — what you are trying to do is perfectly valid, once you’ve sorted out some of the use of & and * in a place or two.
-
09-11-2001
#6

the Corvetter
So, how come that my code was invalid? I had right syntax (I think). I had this:
Code:
char first[10]; const char *ptrfirst = &first; char last[10]; char *const ptrlast = &last; int main() { ptrfirst = "Thomas"; /* Is this legal? I'm changing the pointer, not the object it points to, right? */ *ptrlast = "Jefferson"; /* Is this legal? I'm changing the object that the pointer points to, not the pointer, right? return (0); }Isn’t this code right? If not, why? Thanks!
-
09-11-2001
#7

and the hat of int overfl
> const char *ptrfirst = &first;
Recall my previous post about the difference between first and &first.
The levels of indirection are the same, but the pointers are of an incompatible type
So
const char *ptrfirst = first;> ptrfirst = «Thomas»;
Nothing wrong here — ptrfirst is a (variable) pointer to a const char, so assigning the pointer to point to another char is valid.
«string» has the type const char *
So you have these types in the assignment.
const char * = const char *
so all is well> *ptrlast = «Jefferson»;
I get this — warning: assignment makes integer from pointer without a cast
What you’re trying to do here is take a pointer (to the string), cast it to an integer and truncate it so it fits inside a single character.
You have these types in the assignment.
char = const char *
a char just being a small integerIf you tried this
> ptrlast = «Jefferson»;
I get this — warning: assignment of read-only variable `ptrlast’
Althought the types match, you’ve said that ptrlast is a constant, so it complains when you try and modify the pointer.To update this, you would need something like
strcpy( ptrlast, «Jefferson» );
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS
Contact US
Thanks. We have received your request and will respond promptly.
Log In
Come Join Us!
Are you a
Computer / IT professional?
Join Tek-Tips Forums!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts - Keyword Search
- One-Click Access To Your
Favorite Forums - Automated Signatures
On Your Posts - Best Of All, It’s Free!
*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Students Click Here
compiler error «Different levels of indirection»compiler error «Different levels of indirection»(OP) 12 Mar 02 12:23 Could somebody please explain what this message means? I have looked at the microsoft site, but it has helped little. James Goodman Red Flag SubmittedThank you for helping keep Tek-Tips Forums free from inappropriate posts. |
Join Tek-Tips® Today!
Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.
Here’s Why Members Love Tek-Tips Forums:
Talk To Other Members- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More…
Register now while it’s still free!
Already a member? Close this window and log in.
Join Us Close
- Remove From My Forums
-
Question
-
hello ,
i’m writing a B+tree implementation in C . using visual studios 2008
i built 2 header files to help me with some functionality,
one is called linked.h witch holds function and structs witch implement a stack using linked list ( for tree traversel , the other is called nodewraper.h , it holds a struct for node ( of a B+tree ) and another struct called node_wraper witch encapsulates
the node and the current visited pointer number (index)all the above is irrelevant , and is just written for thous people who just have to know what i’m trying to do .
i believe in focusing the problem :
iv’e underlined the error below in the code , this is the header file nodewraper.h ,
the error returns twice in make_leaf and make_node , i cant figure out its origin .
iv’e tried replacing node* with void* to imply a general type but i got the same error as before only with void* instead of node*#include<linked.h> #include<stdlib.h> #define order 5 typedef struct node { void ** pointers; int * keys; struct node * parent; int is_leaf; int num_keys; struct node * next; } node; typedef struct { node* _node ; int visited ; }node_wraper; void Init(node** root) { (*root) = make_leaf(); (*root)->parent = NULL; return root; } node* make_leaf() { // here i get an error : : 'make_leaf' : 'node*()' //differs in levels of indirection from 'int ()' node* leaf = make_node(); leaf->is_leaf = 1; return leaf; } // end make_leaf node* make_node() { // here i get an error : error C2040 : 'make_node' : 'node*()' //differs in levels of indirection from 'int ()' node* new_node; new_node =(node*)malloc(sizeof(node)); if (new_node == NULL) { perror("Node creation."); exit(EXIT_FAILURE); } new_node->keys =(int*) malloc( (order - 1) * sizeof(int) ); if (new_node->keys == NULL) { perror("New node keys array."); exit(EXIT_FAILURE); } new_node->pointers =(node**)malloc( order * sizeof(node*) ); if (new_node->pointers == NULL) { perror("New node pointers array."); exit(EXIT_FAILURE); } new_node->is_leaf = 0; new_node->num_keys = 0; new_node->parent = NULL; new_node->next = NULL; return new_node; } // end make node
Answers
-
On 6/22/2011 8:17 PM, eranotz50 wrote:
void Init(node** root)
{ (*root) = make_leaf();You are calling a function without declaring it first. In C++, this is illegal. But the C compiler accepts it and synthesizes a declaration for you — like this:
int make_leaf();
node* make_leaf()
{ // here i get an error : : ‘make_leaf’ : ‘node*()’
//differs in levels of indirection from ‘int ()’And here the compiler complains that the function signature differs from the one it synthesized earlier.
Bottom line — declare names before using them.
Igor Tandetnik
-
Marked as answer by
Thursday, June 23, 2011 1:26 AM
-
Marked as answer by
| View previous topic :: View next topic | ||||||||||||||
| Author | Message | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
jeremiah Joined: 20 Jul 2010
|
|
|||||||||||||
|
Ttelmah Joined: 11 Mar 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
Ttelmah Joined: 11 Mar 2010
|
|
|||||||||||||
|
jeremiah Joined: 20 Jul 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
Ttelmah Joined: 11 Mar 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
Ttelmah Joined: 11 Mar 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
Ttelmah Joined: 11 Mar 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
jeremiah Joined: 20 Jul 2010
|
|
|||||||||||||
|
septillion Joined: 21 Jan 2010
|
|
|||||||||||||
|
|
You cannot post new topics in this forum |
Powered by phpBB © 2001, 2005 phpBB Group
I am posting two threads because I have two different problems, but both have the same background information.
Common Background Information:
I am trying to rebuild code for a working, commercially sold application with only partial build instructions. The previous maintainer of the code (a mixture of C and C++) is no longer with the company, but when he built the code he used MSVC++, and though I am not certain of the version he was using, I think it was either 4.0 or 6.0. I have only a little experience building with this environment (I am otherwise a seasoned developer) so I need help getting past a couple of issues that I have encountered. Computers (and backups of those computers) previously used for running this build are now completely unavailable.
I have set up the build on my system using MSVC++ 6.0. The source repository contained a workspace (.dsw) file that I am using for all of the projects. I do not have specific instructions for this product on how to adjust the references to libraries, includes, etc. for a particular machine, but I am using instructions for this from a similar (in terms of languages and tools used) product that was written around the same time. I have gotten 43 of 53 classes (projects) to build, but am getting primarily two errors with the remaining 10 clases (projects).
Because I know this code base was building properly (for someone else who is no longer available on a machine that is no longer available), I would strongly prefer adjustments to the build environment over code modification to get it to work, so please focus your assistance/suggestions in this area.
Thanks !
Problem #1: Error C2040: … differs in levels of indirection from …
Here are the exact error messages I am receiving:
Fxactn.cpp
develop3rdPartyxvtdsp45w32_x86includexvt_type.h(54) : error C2040: ‘LONG_PTR’ : ‘long *’ differs in levels of indirection from ‘long’
develop3rdPartyxvtdsp45w32_x86includexvt_type.h(55) : error C2040: ‘ULONG_PTR’ : ‘unsigned long *’ differs in levels of indirection from ‘unsigned long’
Fxapifun.cpp
C:PROGRAM FILESMICROSOFT SDKINCLUDEbasetsd.h(92) : error C2040: ‘LONG_PTR’ : ‘long’ differs in levels of indirection from ‘long *’
C:PROGRAM FILESMICROSOFT SDKINCLUDEbasetsd.h(93) : error C2040: ‘ULONG_PTR’ : ‘unsigned long’ differs in levels of indirection from ‘unsigned long *’
Guicinit.cpp
develop3rdPartyxvtdsp45w32_x86includexvt_type.h(54) : error C2040: ‘LONG_PTR’ : ‘long *’ differs in levels of indirection from ‘long’
develop3rdPartyxvtdsp45w32_x86includexvt_type.h(55) : error C2040: ‘ULONG_PTR’ : ‘unsigned long *’ differs in levels of indirection from ‘unsigned long’
The first two errors and the last two errors come from the same include file. I put the errors twice simply to emphasize that I am receiving these errors on multiple source files. The middle two errors are only occurring once.
Here are lines 41 through 58 of xvt_type.h (apparently a third party include file):
typedef unsigned short T_LNUM;
typedef unsigned short T_PNUM;
typedef unsigned long XVT_COLOR_TYPE; /* Color Component Type (XVT_COLOR_* */
/* The following legacy "data types" are being phased out, as they cause */
/* problems with constness: "const int *x" is NOT same as "const INT_PTR x" */
//typedef int *INT_PTR;
typedef BOOLEAN *BOOLEAN_PTR;
typedef char XVT_BYTE; /* raw data */
typedef unsigned char XVT_UBYTE; /* raw data */
typedef XVT_BYTE *DATA_PTR; /* ptr to arbitrary data - backwards compat. */
typedef XVT_UBYTE *UDATA_PTR; /* unsigned ptr to arbitrary data */
typedef XVT_UBYTE DATA_BYTE; /* for raw data */
typedef long *LONG_PTR; [B]/* THIS IS LINE 54 */[/B]
typedef unsigned long *ULONG_PTR; [B]/* THIS IS LINE 55 */[/B]
/* define a point to function which will be used in xvt_win_enum_wins etc. */
typedef XVT_CALLCONV_TYPEDEF( BOOLEAN, XVT_ENUM_CHILDREN, (WINDOW child, long data));
Here are the first 98 lines of the BaseTsd.h file:
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
basetsd.h
Abstract:
Type definitions for the basic sized types.
Author:
Revision History:
--*/
#ifndef _BASETSD_H_
#define _BASETSD_H_
#if _MSC_VER > 1000
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef signed char INT8, *PINT8;
typedef signed short INT16, *PINT16;
typedef signed int INT32, *PINT32;
typedef signed __int64 INT64, *PINT64;
typedef unsigned char UINT8, *PUINT8;
typedef unsigned short UINT16, *PUINT16;
typedef unsigned int UINT32, *PUINT32;
typedef unsigned __int64 UINT64, *PUINT64;
//
// The following types are guaranteed to be signed and 32 bits wide.
//
typedef signed int LONG32, *PLONG32;
//
// The following types are guaranteed to be unsigned and 32 bits wide.
//
typedef unsigned int ULONG32, *PULONG32;
typedef unsigned int DWORD32, *PDWORD32;
#if !defined(_W64)
#if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
#define _W64 __w64
#else
#define _W64
#endif
#endif
//
// The INT_PTR is guaranteed to be the same size as a pointer. Its
// size with change with pointer size (32/64). It should be used
// anywhere that a pointer is cast to an integer type. UINT_PTR is
// the unsigned variation.
//
// __int3264 is intrinsic to 64b MIDL but not to old MIDL or to C compiler.
//
#if ( 501 < __midl )
typedef [public] __int3264 INT_PTR, *PINT_PTR;
typedef [public] unsigned __int3264 UINT_PTR, *PUINT_PTR;
typedef [public] __int3264 LONG_PTR, *PLONG_PTR;
typedef [public] unsigned __int3264 ULONG_PTR, *PULONG_PTR;
#else // midl64
// old midl and C++ compiler
#if defined(_WIN64)
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
#define __int3264 __int64
#else
typedef _W64 int INT_PTR, *PINT_PTR;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
typedef _W64 long LONG_PTR, *PLONG_PTR;
typedef _W64 unsigned long ULONG_PTR, *PULONG_PTR;
#define __int3264 __int32
#endif
#endif // midl64
My thoughts so far are as follows:
- One possibility is that the previous builder of this code precompiled these (and probably all 3rd party and MS) headers separately using a different environment or different settings prior to the build, and he had the pre-compiled headers available when he ran the main build, so he would not have gotten these errors.
- Another possibility is that the previous builder was using different settings for the compile than I am using — perhaps a older version compatability flag or something like that. However, if this was on the main build (as opposed to a separate run to precompile header files) I would expect that setting to be in the saved workspace (.dsw) file.
- The only other possibility that I have been able to come up with is that the previous builder was using or pointing to a later version of these header files than I am. I will look into this possibility, but I wanted to go ahead and post to get the ball rolling first, in case someone else had other helpful ideas.
Any thoughts or suggestions from an experienced MSVC++ user would be greatly appreciated.
Помогите пожалуйста разобраться с ошибками в коде
вот код:
| C++ | ||
|
При компиляции компилятор выдаёт такое:
» D:111111.cpp(24) : error C2679: binary ‘>>’ : no operator defined which takes a right-hand operand of type ‘int [100]’ (or there is no acceptable conversion)
D:111111.cpp(25) : error C2679: binary ‘>>’ : no operator defined which takes a right-hand operand of type ‘int [100]’ (or there is no acceptable conversion)
D:111111.cpp(27) : error C2679: binary ‘>>’ : no operator defined which takes a right-hand operand of type ‘int [100]’ (or there is no acceptable conversion)
D:111111.cpp(28) : error C2679: binary ‘>>’ : no operator defined which takes a right-hand operand of type ‘int [100]’ (or there is no acceptable conversion)
D:111111.cpp(35) : error C2446: ‘>’ : no conversion from ‘int *’ to ‘int’
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:111111.cpp(35) : error C2040: ‘>’ : ‘int’ differs in levels of indirection from ‘int [100]’
D:111111.cpp(37) : error C2446: ‘>’ : no conversion from ‘int *’ to ‘int’
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
D:111111.cpp(37) : error C2040: ‘>’ : ‘int’ differs in levels of indirection from ‘int [100]’ «
если понадобится — это решение вот этой задачи задачи:
«В справочной автовокзала хранится расписание движения автобусов.
Для каждого рейса указаны его номер, тип автобуса, пункт назначения, время
отправления и прибытия. Вывести информацию о рейсах, которыми можно
воспользоваться для прибытия в пункт назначения раньше заданного времени.»
__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь
Я получаю несколько ошибок компилятора, которые происходят из моего Copy-Constructor. Я понимаю, что первая ошибка происходит из-за несовместимых типов операндов, я просто не уверен в лучшем способе написания этого кода. И вторая ошибка, в которой я совсем не уверен. Почему бы не '=' быть в состоянии преобразовать из Узла * в Узел *?
Любая помощь или направление будут оценены.
Спасибо!
// Copy-Constructor
List::List(const List& theList)
{
Node* tempPtr = new Node;
tempPtr = theList.first;
//error C2040: 'tempPtr' : 'List' differs in levels of indirection from 'Node *'
List(tempPtr);
while (tempPtr != NULL)
{
Node* copyNode = new Node;
//error C2440: '=' :cannot convert from 'Node *' to 'Node *'
copyNode = tempPtr;
tempPtr = tempPtr->getNext();
nodeListTotal++;
}
}
Ниже мой конструктор и деструктор.
List::List():first(0), last(0), nodeListTotal(0)
{
}
// Destructor
List::~List()
{
Node* currentNode = first;
while(currentNode != NULL)
{
Node* temp = currentNode;
currentNode = currentNode->getNext();
delete temp;
}
}
0
Решение
Здесь есть несколько проблем. Во-первых, C2040 и C2440, где типы одного типа. На основании того, что я нашел в этой дискуссии, круглые скобки разрешены в объявлении, поэтому утверждение:
List(tempPtr);
по-видимому, эквивалентно:
List tempPtr;
Следовательно, ошибка — это очень запутанный способ сказать, что вы объявили переменную tempPtrи вы дали ему другой тип. Но учтите, что если вы написали List*(tempPtr) было бы сказать redefinition: different basic typesтак что это также, похоже, связано с тем, что List не столько указатель, сколько Node* (вот откуда берется «уровень косвенности»). C2440 происходит из-за повторного объявления. Вы можете подтвердить это, комментируя List(tempPtr); и увидев, что код скомпилируется. Однако тот факт, что он будет компилироваться, вовсе не означает, что это правильно.
Проблема № 2 в том, что вы не показываете здесь конструктор, принимающий Node*и даже если бы у вас был один, это не будет правильным способом назвать это. Я не совсем уверен, что вы пытаетесь сделать с этим.
Проблема № 3 в том, что вы протекаете Node объекты как сумасшедшие. Когда вы выполняете строки:
Node* tempPtr = new Node;
tempPtr = theList.first;
а также
Node* copyNode = new Node;
copyNode = tempPtr;
вы распределяете Node объекты, а затем выбрасывая указатели на них. Если вы пытаетесь скопировать Node объекты, это не способ сделать это. Вам тоже нужен конструктор копирования.
Это не все, что входит в правильный конструктор копирования для вашего List класс, но он покрывает некоторые из самых больших проблем с кодом, который вы разместили, и, особенно, кажется, именно поэтому вы получаете эти две ошибки.
0
Другие решения
Ситуация выглядит как сочетание какого-то недопонимания с вашей стороны и ошибки компилятора.
Формально заявление
List(tempPtr);
должен интерпретироваться компилятором как объявление
List tempPtr;
В спецификации языка 6.8 (C ++ 03) четко указано, что неоднозначность между объявлением и функциональным выражением приведена в пользу или объявлении. Это означает, что у вас есть недопустимая переопределение переменной tempPtr, Вы уже заявили tempPtr раньше с другим типом.
Тем не менее, сообщение об ошибке, выдаваемое компилятором, похоже, предполагает, что компилятор интерпретировал его как функциональное выражение приведения (вместо объявления). Это выражение пытается создать безымянный временный объект типа List из указателя tempPtr типа Node *, Этот временный объект (если он успешно создан) будет немедленно уничтожен. Тем не менее, класс List не имеет конструктора, который может построить его из Node * указатель. Это то, что говорит вам компилятор. Твой класс List имеет только один однопараметрический конструктор, который принимает const List &в то время как вы поставили Node *, Компилятор говорит вам, что не может конвертировать Node * в List чтобы вызвать этот конструктор.
Тем не менее, независимо от того, как кто-то интерпретирует это утверждение (выражение или объявление), это не имеет смысла в контексте вашего кода. Это сломано в любом случае. Итак, в основном, вопрос в том, что на Земле вы пытаетесь делать с этим List(tempPtr); линия? Каково было ваше намерение?
Вторая ошибка, вероятно, вызвана первой.
0