gpt4 book ai didi

c++ - 从limemicro编译lms6suite时出现枚举错误

转载 作者:行者123 更新时间:2023-12-02 11:01:01 24 4
gpt4 key购买 nike

我刚刚从https://github.com/limemicro/lms6suite从lime Microsystem下载了lms6002的控制软件。
我尝试编译但出现错误

[  1%] Building CXX object CMakeFiles/lms-suite.dir/gui_src/lms_suiteMain.cpp.o In file included from /usr/include/GL/glx.h:30:0,
from /usr/local/include/wx-3.0/wx/unix/glx11.h:13,
from /usr/local/include/wx-3.0/wx/gtk/glcanvas.h:14,
from /usr/local/include/wx-3.0/wx/glcanvas.h:192,
from /home/gabriel/ELSE/lms6suite/gui_src/fft/oglGraph/OpenGLGraph.h:15,
from /home/gabriel/ELSE/lms6suite/gui_src/fft/pnlFFTviewer.h:17,
from /home/gabriel/ELSE/lms6suite/gui_src/lms_suiteMain.cpp:32: /home/gabriel/ELSE/lms6suite/gui_src/pnlLMS6002USB.h:39:14:
error: expected identifier before ‘int’
enum Status { SUCCESS, FAILURE };
^ In file included from /home/gabriel/ELSE/lms6suite/gui_src/lms_suiteMain.cpp:44:0: /home/gabriel/ELSE/lms6suite/gui_src/pnlLMS6002USB.h:39:21:
error: expected unqualified-id before ‘{’ token
enum Status { SUCCESS, FAILURE };
^ CMakeFiles/lms-suite.dir/build.make:1142: recipe for target 'CMakeFiles/lms-suite.dir/gui_src/lms_suiteMain.cpp.o' failed make[2]:
*** [CMakeFiles/lms-suite.dir/gui_src/lms_suiteMain.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/lms-suite.dir/all' failed make[1]: *** [CMakeFiles/lms-suite.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

这里是有问题的头文件:
  1 #ifndef PNLLMS6002USBSTICK_H
2 #define PNLLMS6002USBSTICK_H
3
4 #include <wx/panel.h>
5 class wxStaticText;
6 class wxFlexGridSizer;
7 class wxButton;
8
9 #include "PluginPanel.h"
10 class ConnectionManager;
11
12 class pnlLMS6002USB: public wxPanel, public PluginPanel
13 {
14 public:
15 pnlLMS6002USB(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int st yle = 0, wxString name = "");
16 void Initialize( ConnectionManager *pControl);
17 virtual ~pnlLMS6002USB();
18 virtual void UpdatePanel();
19
20 wxButton* btnUpdateAll;
21 wxComboBox* cmbVCXOcontrolVoltage;
22
23 wxPanel* mPanelStreamPLL;
24 wxTextCtrl* txtPllFreqRxMHz;
25 wxStaticText* lblRealFreqTx;
26 wxStaticText* lblRealFreqRx;
27 wxTextCtrl* txtPllFreqTxMHz;
28 wxTextCtrl* txtPhaseOffsetDeg;
29 wxButton* btnConfigurePLL;
30
31 static const long ID_BUTTON_UPDATEALL;
32 static const long ID_VCXOCV;
33
34 void OnbtnUpdateAll(wxCommandEvent& event);
35 void ParameterChangeHandler(wxCommandEvent& event);
36 protected:
37 void OnConfigurePLL(wxCommandEvent &event);
38
39 enum Status { SUCCESS, FAILURE };
40
41 Status ConfigurePLL(ConnectionManager *serPort, const float fOutTx_MHz, const float fOutRx_MHz, const float phaseShift_deg);
42
43 protected:
44 ConnectionManager *m_serPort;
45 void BuildContent(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size);
46
47 DECLARE_EVENT_TABLE()
48 };
49
50 #endif

复制步骤:
git clone https://github.com/limemicro/lms6suite lms6suite
cd lms6suite
cd build
cmake ../
make

有人可以告诉我这是哪里来的吗?

非常感谢:)

最佳答案

问题几乎可以肯定是由于使用“状态”一词作为枚举的名称。该名称会导致编译器错误,因为Xlib.h(显然间接包含在上述程序中)包含以下行:

#define Status int

因此,在预处理之后,定义为:
enum int { SUCCESS, FAILURE };

这是无效的C++。最好重命名该枚举。

关于c++ - 从limemicro编译lms6suite时出现枚举错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40630096/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com