I have creating a serial port based data acquisition project using Win32API and C++.
I am going to request data from my embedded device using serial port and save the data in a file on my PC.
The program has been designed in modular fashion for future maintenance.
Their are 3 classes (each in its own C++ source file and a header file associated with them) :
(1) SerialCommunication - Handles all actual communication routines like Open, Close, WriteFile, ReadFile and some support functions.
(2) FileOperations - Handles all file related I/O functions
(3) SerialProtocol - Contains all communication protocol functionalities and logic how to communicate with the embedded device.
SerialProtocol member functions abstract this entire process by creating and destrying SerialCommunication and FileOperations objects as needed in order to communicate with embedded device and save data on a file.
The main function only handles SerialProtocol class members and member functions.
I am able to create SerialCommunication object in my main function and successfully establish communication.
However I am unable to do the same in SerialProtocol class member functions.
I get an error stating : 'SerialCommunication' is not declared in scope.
I have included the proper header. The header contains include guard.
Tools Used :
Compiler : MingW-w64 64-bits with POSIX thread and SEH
IDE : Netbeans 8.1 with a ton of plug-ins installed
Several open source libraries have been installed.
Do you get the same error if you compile SerialProtocol.cpp from the command line? g++ -std=c++14 -Wall -Wextra -pedantic-errors -c SerialProtocol.cpp
(if required, add the option -I<directory to be searched for include files>)
> how can I upload my files as the code has become too long.
A skeleton of the file SerialCommunication.h showing the #include guards, other preprocessor directives (if any) and partial class definition (begin and end)
and a skeleton of the files SerialProtocol.h and SerialProtocol.cpp (the preprocessor directives and the line manifesting the 'SerialCommunication' is not declared' error)