• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Daniel Duffy's C++ ExcelDriver

Daniel Duffy

C++ author, trainer
Joined
10/4/07
Messages
10,091
Points
648
"My office is 365, which is 2016."

I don't have Excel 2016 myself but I know someone has it and I am using VS2017.

What are the settings to be made in ExcelImports.cpp to get it running?

muchos gracias

@APalley
@GONG CHEN
 
oops! I don't have permission to read that link.

It is someone who is doing my FDM course.
 
Last edited:
Hey @APalley

I solve this after I reinstalled my Excel 2017(office 360) and I kept all the installing setting in default. I also ran VS in administration mode.

Also my path code is

#import "C:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\MSO.DLL" rename("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RGBXL")
#import "C:\Program Files\Microsoft Office\root\VFS\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") rename("DocumentProperties", "DocumentPropertiesXL") rename("ReplaceText", "ReplaceTextXL") rename("CopyFile", "CopyFileXL") no_dual_interfaces
 
Anyone using the Driver with Excel 2019? This works ==>

C++:
#import "C:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\OFFICE16\MSO.DLL" rename("DocumentProperties", "DocumentPropertiesXL") rename("RGB", "RGBXL")

#import "C:\Program Files (x86)\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"

#import "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") rename("DocumentProperties", "DocumentPropertiesXL") rename("ReplaceText", "ReplaceTextXL") rename("CopyFile", "CopyFileXL") no_dual_interfaces
 
Last edited:
What is the exact error you see?
1>------ Build started: Project: ODE Test, Configuration: Debug Win32 ------
1>ExcelDriverLite.cpp
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2146: syntax error: missing ')' before identifier 'sheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(53): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(53): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2146: syntax error: missing ')' before identifier 'sheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(82): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(82): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2065: '_com_error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2065: 'error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2182: 'ThrowAsString': illegal use of type 'void'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(106): error C2448: 'ThrowAsString': function-style initializer appears to be a function definition
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(118): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(119): error C2550: 'ExcelDriver': constructor initializer lists are only allowed on constructor definitions
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(123): error C3861: 'CoInitialize': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(126): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2065: 'xlWorksheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: '_WorkbookPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2146: syntax error: missing ';' before identifier 'pWorkbook'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2146: syntax error: missing ';' before identifier 'pSheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(135): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(137): error C2061: syntax error: identifier '_com_error'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(137): error C2310: catch handlers must specify one type
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(139): error C2065: 'error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(141): warning C4508: 'ExcelDriver': function should return a value; 'void' return type assumed
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(145): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(145): error C2523: '<Unknown>::~ExcelDriver': destructor tag mismatch
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(146): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(148): error C3861: 'CoUninitialize': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(149): warning C4508: 'ExcelDriver': function should return a value; 'void' return type assumed
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2143: syntax error: missing ';' before '&'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2365: 'ExcelDriver': redefinition; previous definition was 'function'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2059: syntax error: '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2039: 'list': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\complex(40): note: see declaration of 'std'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2143: syntax error: missing ',' before '<'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: '_WorkbookPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2146: syntax error: missing ';' before identifier 'pWorkbook'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2146: syntax error: missing ';' before identifier 'pSheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(181): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(183): error C2065: 'vectorList': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'xTitle': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C3861: 'ToSheetVertical': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(187): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2039: 'list': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\complex(40): note: see declaration of 'std'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2275: 'std::string': illegal use of this type as an expression
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): note: see declaration of 'std::string'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2039: 'const_iterator': is not a member of '`global namespace''
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'const_iterator': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2146: syntax error: missing ';' before identifier 'labelIt'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'labels': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(191): error C2065: 'vectorList': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(191): error C3536: 'vectorIt': cannot be used before it is initialized
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(194): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2100: illegal indirection
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C3861: 'ToSheetVertical': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(200): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(200): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2146: syntax error: missing ';' before identifier 'pBeginRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'pBeginRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2146: syntax error: missing ';' before identifier 'pEndRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'pEndRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2146: syntax error: missing ';' before identifier 'pTotalRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'pTotalRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'Range': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2059: syntax error: ')'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(209): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(209): fatal error C1003: error count exceeds 100; stopping compilation
 
1>------ Build started: Project: ODE Test, Configuration: Debug Win32 ------
1>ExcelDriverLite.cpp
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(50): error C2146: syntax error: missing ')' before identifier 'sheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(53): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(53): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(79): error C2146: syntax error: missing ')' before identifier 'sheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(82): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(82): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2065: '_com_error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2065: 'error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(105): error C2182: 'ThrowAsString': illegal use of type 'void'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(106): error C2448: 'ThrowAsString': function-style initializer appears to be a function definition
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(118): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(119): error C2550: 'ExcelDriver': constructor initializer lists are only allowed on constructor definitions
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(123): error C3861: 'CoInitialize': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(126): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(127): error C2065: 'xlWorksheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: '_WorkbookPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2146: syntax error: missing ';' before identifier 'pWorkbook'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(132): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2146: syntax error: missing ';' before identifier 'pSheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(134): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(135): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(137): error C2061: syntax error: identifier '_com_error'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(137): error C2310: catch handlers must specify one type
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(139): error C2065: 'error': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(141): warning C4508: 'ExcelDriver': function should return a value; 'void' return type assumed
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(145): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(145): error C2523: '<Unknown>::~ExcelDriver': destructor tag mismatch
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(146): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(148): error C3861: 'CoUninitialize': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(149): warning C4508: 'ExcelDriver': function should return a value; 'void' return type assumed
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2143: syntax error: missing ';' before '&'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2365: 'ExcelDriver': redefinition; previous definition was 'function'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(153): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2059: syntax error: '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2143: syntax error: missing ';' before '{'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(154): error C2447: '{': missing function header (old-style formal list?)
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2653: 'ExcelDriver': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2039: 'list': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\complex(40): note: see declaration of 'std'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(166): error C2143: syntax error: missing ',' before '<'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: '_WorkbookPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2146: syntax error: missing ';' before identifier 'pWorkbook'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(175): error C2065: 'xl': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: '_WorksheetPtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2146: syntax error: missing ';' before identifier 'pSheet'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(176): error C2065: 'pWorkbook': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(181): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(183): error C2065: 'vectorList': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C2065: 'xTitle': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(186): error C3861: 'ToSheetVertical': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(187): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2039: 'list': is not a member of 'std'
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.16.27023\include\complex(40): note: see declaration of 'std'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2275: 'std::string': illegal use of this type as an expression
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): note: see declaration of 'std::string'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2039: 'const_iterator': is not a member of '`global namespace''
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'const_iterator': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2146: syntax error: missing ';' before identifier 'labelIt'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(190): error C2065: 'labels': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(191): error C2065: 'vectorList': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(191): error C3536: 'vectorIt': cannot be used before it is initialized
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(194): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C2100: illegal indirection
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(197): error C3861: 'ToSheetVertical': identifier not found
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(200): error C2065: 'curDataColumn': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(200): error C2065: 'labelIt': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2146: syntax error: missing ';' before identifier 'pBeginRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'pBeginRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(204): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2146: syntax error: missing ';' before identifier 'pEndRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'pEndRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(205): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'RangePtr': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2146: syntax error: missing ';' before identifier 'pTotalRange'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'pTotalRange': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'pSheet': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2065: 'Range': undeclared identifier
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(206): error C2059: syntax error: ')'
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(209): error C2653: 'Excel': is not a class or namespace name
1>c:\users\69047\onedrive\desktop\datasim pde\ode101\exceldriverlite.cpp(209): fatal error C1003: error count exceeds 100; stopping compilation
This looks to me like a project structure issue; missing #includes, incorrect additional include directories, and/or incorrect/missing files being linked as part of the project.

Are you using a provided project (similar to the one provided to your during QN C++) or creating your own project with these files?
 
This looks to me like a project structure issue; missing #includes, incorrect additional include directories, and/or incorrect/missing files being linked as part of the project.

Are you using a provided project (similar to the one provided to your during QN C++) or creating your own project with these files?
It is a provided project similar to the one provided during QN C++.
 
Create your own new Console project and add the stuff that is needed

imports
include stuff for ExcelDriver and Boost
#include "ExcelDriverLite.hpp"

at least these and then rebuild.
 
Last edited:
A general remark that causes issues and leads to somewhat (and long) trial-and-error debugging sessions:
  1. Distinguishing between compiler and linking errors; knowing what they are, what causes them and how to resolve them.
  2. Seeing a compiler as a series of steps to translate Hello.cpp to Hello.exe
  3. Really reading error messages and go to step 1.
  4. When debugging, reduce the scope (e.g. 1st test w/o ExcelDriver). Solving 2 problems simultaneously is not a good idea.
  5. Take an analytical approach.
In one of my early modules I explain the compilation process.
 
Last edited:
Create your own new Console project and add the stuff that is needed

imports
include stuff for ExcelDriver and Boost
#include "ExcelDriverLite.hpp"

at least these and then rebuild.
Is Excel working? What was the 'missing step'?
 
Back
Top