Error C2146 Error C2501
and get tips & solutions from a community of 418,505 IT Pros & Developers. It's quick & easy. error C2146 and error C2501 P: n/a Tim I lpctstr undeclared identifier created a header file including a Node Class and a NodeList Class. class Node{ lpctstr include file Node* next; }; class NodeList{ Node* first; Node* last; }; I wanna declare a NodeList inside the Node but since NodeList is declared after Node it gives me this error class Node{ Node* next; NodeList list; }; I get: error C2146: syntax error : missing ';' before identifier 'list' error C2501: 'Node::list' : missing storage-class or type specifiers error C2501: 'Node::NodeList' : missing storage-class or type specifiers I tried to include both in different header files with each one referencing the other but it was a wrose idea since the linker was looping Is there any way I can overcome this? Thank you Jul 22 '05 #1 Post Reply Share this Question 1 Reply P: n/a John Harrison "Tim"
Studio Languages , Windows Desktop Development > C++ Standards, Extensions, and Interop Question 0 Sign in to vote Hi AllI have created a project in ATL.when I compile it in UNICODE release mode..I get following errors...C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afx.h(1234): error C2433: 'CFileFind::CString' : 'virtual' https://bytes.com/topic/c/answers/134403-error-c2146-error-c2501 not permitted on data declarationsC:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(37): error C2039: 'ChTraitsCRT' : is not a member of 'ATL'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(37): error C2039: 'ChTraitsCRT' : is not a member of 'ATL'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(37): error C2039: 'ChTraitsCRT' https://social.msdn.microsoft.com/Forums/vstudio/en-US/44f67c0e-a202-4d50-b137-e6ecadc983c4/need-help-atl-unicode-release-mode-project-settings?forum=vclanguage : is not a member of 'ATL'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(100): error C2059: syntax error : '>'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(101): error C2059: syntax error : '>'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(102): error C2059: syntax error : '>'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afx.h(1135): error C2061: syntax error : identifier 'CString'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afx.h(1483): error C2061: syntax error : identifier 'CString'C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atltime.h(320): error C2064: term does not evaluate to a function taking 1 argumentsC:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atltime.h(388): error C2064: term does not evaluate to a function taking 1 argumentsC:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atltime.h(393): error C2064: term does not evaluate to a function taking 1 argumentsC:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxstr.h(37): error C2065: 'ChTraitsCRT' : undeclared identifierC:\Program File
Windows Desktop Development > C++ Standards, Extensions, and Interop Question 0 Sign in to vote I am trying to call a C# component developed by an external firm from https://social.msdn.microsoft.com/Forums/vstudio/en-US/044f5943-4acd-4a06-b9a4-de3c6f4dd54f/calling-a-c-component-from-c?forum=vclanguage C++.I imported the type library provided to me. When I try to compile using MSVC 6.0 compiler , I get the following error.error C2146: syntax error : missing ';' before identifier 'GetType'error C2501: http://forums.windowsecurity.com/viewtopic.php?t=25224 '_TypePtr' : missing storage-class or type specifierserror C2143: syntax error : missing ';' before 'tag::id'error C2433: '_TypePtr' : 'inline' not permitted on data declarationserror C2501: '_TypePtr' : missing storage-class or type specifiersfatal error C1004: error c2146 unexpected end of file found.Any information will be highly appreciated.Thank you Wednesday, July 25, 2007 7:15 PM Reply | Quote Answers 0 Sign in to vote #import isn't particulary sophisticated. The compiler frontend simply reads the type library and emits code for it (the .tlh and depending on the import attributes the .tli files). After that everything is done as usual. You can still preprocess the code error c2146 error to remove any macro interference. Just take a look at the (possibly compiler-generated) source code for the first error. How does the last thing before it look like? And how does the line with error look like? -hg Wednesday, July 25, 2007 11:12 PM Reply | Quote All replies 0 Sign in to vote #import isn't particulary sophisticated. The compiler frontend simply reads the type library and emits code for it (the .tlh and depending on the import attributes the .tli files). After that everything is done as usual. You can still preprocess the code to remove any macro interference. Just take a look at the (possibly compiler-generated) source code for the first error. How does the last thing before it look like? And how does the line with error look like? -hg Wednesday, July 25, 2007 11:12 PM Reply | Quote 1 Sign in to vote Try using your #import instruction with "raw_interfaces_only", as in: #import "YourTypeLibrary.tlb" raw_interfaces_only Proposed as answer by Fei. _ Thursday, July 30, 2009 6:55 AM Tuesday, July 31, 2007 9:21 AM Reply | Quote 0 Sign in to vote Thanks for the tip.. That helped in gett
| Recent Posts
Windows Encryption APIUsers browsing this topic:0 Security Fans, 0 Stealth Security Fans Registered Security Fans: None Networking/Security Forums Index -> Cryptographic Software and Hardware View previous topic :: View next topic Author Message CalemontJust ArrivedJoined: 03 Jan 2005Posts: 0 Posted: Mon Jan 03, 2005 5:06 pm Post subject: Windows Encryption API Okay, need a little help here. I've downloaded the sample software for Windows Encryption (the '5003' workspace from the developer's site), and it's not compiling as is. This is Visual C++ 6.0, and here are the errors I'm getting. There are 80 of them, and they seem to mainly deal with classes defined in the WINCRYPT.H header file. If someone has any idea of what I'm talking about or how to get this sample code to work, I would certainly appreciate it. Cale Montgomery Compiling... CEncrypt.CPP c:\msdn\sample\5003\cencrypt.h(25) : error C2146: syntax error : missing ';' before identifier 'GetKeyFromHashedPassword' c:\msdn\sample\5003\cencrypt.h(25) : error C2501: 'HCRYPTKEY' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(26) : error C2061: syntax error : identifier 'HCRYPTPROV' c:\msdn\sample\5003\cencrypt.h(32) : error C2146: syntax error : missing ';' before identifier 'm_hCryptProvider' c:\msdn\sample\5003\cencrypt.h(32) : error C2501: 'HCRYPTPROV' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(32) : error C2501: 'm_hCryptProvider' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(34) : error C2146: syntax error : missing ';' before identifier 'm_Algoritm_ID' c:\msdn\sample\5003\cencrypt.h(34) : error C2501: 'ALG_ID' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(34) : error C2501: 'm_Algoritm_ID' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(37) : error C2146: syntax error : missing ';' before identifier 'm_hKey' c:\msdn\sample\5003\cencrypt.h(37) : error C2501: 'HCRYPTKEY' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(37) : error C2501: 'm_hKey' : missing storage-class or type specifiers c:\msdn\sample\5003\cencrypt.h(38) : error C2146: syntax error : missing ';' before identifier 'm_hHash' c:\msdn\sample\5003\cencrypt.h(38) : error C2501: 'HCRYPTHASH' : missing storage-class or type specifiers c:\msdn\sample\5003\