I'm starting to learn wxWidgets through online tutorials, and so far I have successfully created a very basic GUI in Visual Studio 2019. I was planning on using wxWidgets to create a GUI for a Modbus RTU RS-232 Master application, which will communicate over the serial line with a Modbus slave microcontroller. I have successfully tested the Modbus application in a standalone C++ terminal program (the Modbus library is written in C, but also handles events where it is called from C++), and would now like to include the library in my wxWidgets GUI. However, as soon as I include the Modbus header file in any of the wxWidgets class headers, I get a ton of errors related to the wxWidgets files.
Here is a sample of my code:
cApp.h:
Code: Select all
#pragma once
#include "modbus.h"
#include "wx/wx.h"
#include "cMain.h"
class cApp : public wxApp
{
public:
cApp();
~cApp();
private:
cMain* m_frame1 = nullptr;
public:
virtual bool OnInit();
};
Code: Select all
#include "cApp.h"
wxIMPLEMENT_APP(cApp);
cApp::cApp()
{
}
cApp::~cApp()
{
}
bool cApp::OnInit()
{
m_frame1 = new cMain();
m_frame1->Show();
return true;
}
Code: Select all
Severity Code Description File Line
Error C4996 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\sdks\wx312\include\wx\wxcrt.h 209
Severity Code Description File Line
Error C4996 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\sdks\wx312\include\wx\wxcrt.h 285
Severity Code Description File Line
Error C4996 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\sdks\wx312\include\wx\wxcrt.h 308
Severity Code Description File Line
Error C4996 '_wopen': This function or variable may be unsafe. Consider using _wsopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. C:\sdks\wx312\include\wx\filefn.h 429
Any help would be greatly appreciated.
Regards,
Ksawery