创建动态链接库,头文件报错expected initializer before “function name“

本文解释了_cdecl与__stdcall的区别,以及在函数声明中使用不当导致的初始化问题。重点在于C++调用约定的正确使用,以避免编译错误和潜在的栈溢出风险。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

extern "C" MATHLIBRARY_API void _cdecl fibonacci_init(
    const unsigned long long a, const unsigned long long b);

头文件这个函数前报出expected initializer before “fibonacci_init”,这是由于函数前的_cdecl造成,只有一个下划线的cdecl和两个下划线的__cdecl是同义词,但是某些配置下,它们不一样:

为了与以前的版本兼容, cdecl 和 _cdecl 是一个同义词 __cdecl ,除非指定编译器选项 /Za (禁用语言扩展)

调用规范
语言扩展

因此,函数声明处应该用__cdecl或者直接不写,使用默认的C调用规范。
顺便在此说明一下__cdecl__stdcall的差异,
__cdecl是C语言的默认调用规范:

(1)参数从右向左依次压入堆栈.
(2)由调用者恢复堆栈,称为手动清栈。
(3)函数名自动加前导下划线。

即参数堆栈由调用函数者清理,堆栈空间有限,可能会发生Stack Overflow栈溢出。
__stdcall是C++调用规范:

(1)参数从右向左依次压入堆栈.
(2)由被调用函数自己来恢复堆栈,称为自动清栈。
(3)函数名自动加前导下划线,后面紧跟着一个@,其后紧跟着参数的大小。

C++调用规范下int func( int a, double b ) 的函数按如下所示进行修饰:_func@12

char**)’: /home/rosnoetic/demo2_ws/src/plumbing_pub_sub/src/demo2_pub.cpp:56:17: error: expected initializer before ‘ss’ 56 | ss<<"hello--->"<<count; | ^~ /home/rosnoetic/demo2_ws/src/plumbing_pub_sub/src/demo2_pub.cpp:58:26: error: ‘ss’ was not declared in this scope 58 | msg.data=ss.str(); | ^~ make[2]: *** [plumbing_pub_sub/CMakeFiles/demo2_pub.dir/build.make:63:plumbing_pub_sub/CMakeFiles/demo2_pub.dir/src/demo2_pub.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:418:plumbing_pub_sub/CMakeFiles/demo2_pub.dir/all] 错误 2 make: *** [Makefile:141:all] 错误 2 Invoking "make -j2 -l2" failed * 终端进程“/usr/bin/bash '-c', 'catkin_make'”已终止,退出代码: 1。 * 终端将被任务重用,按任意键关闭。 * 正在执行任务: catkin_make Base path: /home/rosnoetic/demo2_ws Source space: /home/rosnoetic/demo2_ws/src Build space: /home/rosnoetic/demo2_ws/build Devel space: /home/rosnoetic/demo2_ws/devel Install space: /home/rosnoetic/demo2_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/rosnoetic/demo2_ws/build" #### #### #### Running command: "make -j2 -l2" in "/home/rosnoetic/demo2_ws/build" #### Scanning dependencies of target demo2_pub [ 50%] Building CXX object plumbing_pub_sub/CMakeFiles/demo2_pub.dir/src/demo2_pub.cpp.o /home/rosnoetic/demo2_ws/src/plumbing_pub_sub/src/demo2_pub.cpp: In function ‘int main(int, char**)’: /home/rosnoetic/demo2_ws/src/plumbing_pub_sub/src/demo2_pub.cpp:56:17: error: expected initializer before ‘ss’ 56 | ss<<"hello--->"<<count; | ^~ /home/rosnoetic/demo2_ws/src/plumbing_pub_sub/src/demo2_pub.cpp:58:26: error: ‘ss’ was not declared in this scope 58 | msg.data=ss.str(); | ^~ make[2]: *** [plumbing_pub_sub/CMakeFiles/demo2_pub.dir/build.make:63:plumbing_pub_sub/CMakeFiles/demo2_pub.dir/src/demo2_pub.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:418:plumbing_pub_sub/CMake
07-21
In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:296:39: warning: explicit conversion operators only available with -std=c++11 or -std=gnu++11 [enabled by default] G_EXPLICIT_OP operator bool() const G_NOEXCEPT ^ src/greenlet/greenlet_greenlet.hpp:296:39: error: expected ‘;’ at end of member declaration In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:296:45: note: in expansion of macro ‘G_NOEXCEPT’ G_EXPLICIT_OP operator bool() const G_NOEXCEPT ^ src/greenlet/greenlet_compiler_compat.hpp:79:29: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls(const Cls& other) = delete; \ ^ src/greenlet/greenlet_greenlet.hpp:316:9: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(Greenlet); ^ src/greenlet/greenlet_compiler_compat.hpp:80:40: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls& operator=(const Cls& other) = delete ^ src/greenlet/greenlet_greenlet.hpp:316:9: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(Greenlet); ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:345:39: error: expected ‘;’ at end of member declaration inline intptr_t stack_saved() const G_NOEXCEPT ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:345:45: note: in expansion of macro ‘G_NOEXCEPT’ inline intptr_t stack_saved() const G_NOEXCEPT ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:355:42: error: expected ‘;’ at end of member declaration inline const char* stack_start() const G_NOEXCEPT ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:355:48: note: in expansion of macro ‘G_NOEXCEPT’ inline const char* stack_start() const G_NOEXCEPT ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:389:39: error: expected ‘;’ at end of member declaration inline void slp_restore_state() G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:389:41: note: in expansion of macro ‘G_NOEXCEPT’ inline void slp_restore_state() G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:390:55: error: expected ‘;’ at end of member declaration inline int slp_save_state(char *const stackref) G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:390:57: note: in expansion of macro ‘G_NOEXCEPT’ inline int slp_save_state(char *const stackref) G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:428:45: error: expected ‘;’ at end of member declaration virtual ThreadState* thread_state() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:428:51: note: in expansion of macro ‘G_NOEXCEPT’ virtual ThreadState* thread_state() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:432:51: error: expected ‘;’ at end of member declaration virtual bool was_running_in_dead_thread() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:432:57: note: in expansion of macro ‘G_NOEXCEPT’ virtual bool was_running_in_dead_thread() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:436:41: error: expected ‘;’ at end of member declaration virtual BorrowedGreenlet self() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:436:47: note: in expansion of macro ‘G_NOEXCEPT’ virtual BorrowedGreenlet self() const G_NOEXCEPT = 0; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:490:53: error: expected ‘;’ at end of member declaration virtual OwnedGreenlet g_switchstack_success() G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:490:55: note: in expansion of macro ‘G_NOEXCEPT’ virtual OwnedGreenlet g_switchstack_success() G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:333:63: error: ‘nullptr’ was not declared in this scope const OwnedObject context(const typename IsPy37::IsIt=nullptr) const; ^ src/greenlet/greenlet_greenlet.hpp:336:85: error: ‘nullptr’ was not declared in this scope inline void context(refs::BorrowedObject new_context, typename IsPy37::IsIt=nullptr); ^ src/greenlet/greenlet_greenlet.hpp: In constructor ‘greenlet::Greenlet::switchstack_result_t::switchstack_result_t()’: src/greenlet/greenlet_greenlet.hpp:458:43: error: ‘nullptr’ was not declared in this scope the_state_that_switched(nullptr) ^ src/greenlet/greenlet_greenlet.hpp: In constructor ‘greenlet::Greenlet::switchstack_result_t::switchstack_result_t(int)’: src/greenlet/greenlet_greenlet.hpp:463:43: error: ‘nullptr’ was not declared in this scope the_state_that_switched(nullptr) ^ src/greenlet/greenlet_greenlet.hpp: At global scope: src/greenlet/greenlet_greenlet.hpp:561:51: error: expected ‘;’ at end of member declaration virtual bool was_running_in_dead_thread() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:561:57: note: in expansion of macro ‘G_NOEXCEPT’ virtual bool was_running_in_dead_thread() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:562:45: error: expected ‘;’ at end of member declaration virtual ThreadState* thread_state() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:562:51: note: in expansion of macro ‘G_NOEXCEPT’ virtual ThreadState* thread_state() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:578:41: error: expected ‘;’ at end of member declaration virtual BorrowedGreenlet self() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:578:47: note: in expansion of macro ‘G_NOEXCEPT’ virtual BorrowedGreenlet self() const G_NOEXCEPT; ^ src/greenlet/greenlet_compiler_compat.hpp:79:29: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls(const Cls& other) = delete; \ ^ src/greenlet/greenlet_greenlet.hpp:588:13: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(ParentIsCurrentGuard); ^ src/greenlet/greenlet_compiler_compat.hpp:80:40: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls& operator=(const Cls& other) = delete ^ src/greenlet/greenlet_greenlet.hpp:588:13: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(ParentIsCurrentGuard); ^ src/greenlet/greenlet_compiler_compat.hpp:79:29: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls(const Cls& other) = delete; \ ^ src/greenlet/greenlet_greenlet.hpp:606:9: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(MainGreenlet); ^ src/greenlet/greenlet_compiler_compat.hpp:80:40: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11 [enabled by default] Cls& operator=(const Cls& other) = delete ^ src/greenlet/greenlet_greenlet.hpp:606:9: note: in expansion of macro ‘G_NO_COPIES_OF_CLS’ G_NO_COPIES_OF_CLS(MainGreenlet); ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:624:51: error: expected ‘;’ at end of member declaration virtual bool was_running_in_dead_thread() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:624:57: note: in expansion of macro ‘G_NOEXCEPT’ virtual bool was_running_in_dead_thread() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:625:45: error: expected ‘;’ at end of member declaration virtual ThreadState* thread_state() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:625:51: note: in expansion of macro ‘G_NOEXCEPT’ virtual ThreadState* thread_state() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:626:39: error: expected ‘;’ at end of member declaration void thread_state(ThreadState*) G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:626:41: note: in expansion of macro ‘G_NOEXCEPT’ void thread_state(ThreadState*) G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:628:41: error: expected ‘;’ at end of member declaration virtual BorrowedGreenlet self() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_internal.hpp:17:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_compiler_compat.hpp:66:20: error: ‘noexcept’ does not name a type #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:628:47: note: in expansion of macro ‘G_NOEXCEPT’ virtual BorrowedGreenlet self() const G_NOEXCEPT; ^ src/greenlet/greenlet_compiler_compat.hpp:66:20: error: expected initializer before ‘noexcept’ #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:694:68: note: in expansion of macro ‘G_NOEXCEPT’ void ExceptionState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT ^ src/greenlet/greenlet_compiler_compat.hpp:66:20: error: expected initializer before ‘noexcept’ #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:703:62: note: in expansion of macro ‘G_NOEXCEPT’ void ExceptionState::operator>>(PyThreadState *const tstate) G_NOEXCEPT ^ src/greenlet/greenlet_compiler_compat.hpp:66:20: error: expected initializer before ‘noexcept’ #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:713:30: note: in expansion of macro ‘G_NOEXCEPT’ void ExceptionState::clear() G_NOEXCEPT ^ src/greenlet/greenlet_compiler_compat.hpp:66:20: error: expected initializer before ‘noexcept’ #define G_NOEXCEPT noexcept ^ src/greenlet/greenlet_greenlet.hpp:722:61: note: in expansion of macro ‘G_NOEXCEPT’ int ExceptionState::tp_traverse(visitproc visit, void* arg) G_NOEXCEPT ^ src/greenlet/greenlet.cpp:187:32: error: expected declaration before end of line # pragma GCC diagnostic push ^ In file included from src/greenlet/greenlet_greenlet.hpp:11:0, from src/greenlet/greenlet_internal.hpp:20, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_refs.hpp:67:9: warning: inline function ‘void greenlet::refs::MainGreenletExactChecker(void*)’ used but never defined [enabled by default] MainGreenletExactChecker(void *p); ^ src/greenlet/greenlet_refs.hpp:181:19: warning: inline function ‘T* greenlet::refs::PyObjectPointer<T, <anonymous> >::borrow() const [with T = _greenlet; void (* TC)(void*) = greenlet::refs::MainGreenletExactChecker]’ used but never defined [enabled by default] inline T* borrow() const G_NOEXCEPT ^ src/greenlet/greenlet_refs.hpp:181:19: warning: inline function ‘T* greenlet::refs::PyObjectPointer<T, <anonymous> >::borrow() const [with T = _object; void (* TC)(void*) = greenlet::refs::NoOpChecker]’ used but never defined [enabled by default] src/greenlet/greenlet_refs.hpp:191:19: warning: inline function ‘T* greenlet::refs::PyObjectPointer<T, <anonymous> >::operator->() const [with T = _object; void (* TC)(void*) = greenlet::refs::NoOpChecker]’ used but never defined [enabled by default] inline T* operator->() const G_NOEXCEPT ^ In file included from src/greenlet/greenlet_internal.hpp:20:0, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_greenlet.hpp:209:21: warning: inline function ‘bool greenlet::StackState::started() const’ used but never defined [enabled by default] inline bool started() const G_NOEXCEPT; ^ src/greenlet/greenlet_greenlet.hpp:211:21: warning: inline function ‘bool greenlet::StackState::active() const’ used but never defined [enabled by default] inline bool active() const G_NOEXCEPT; ^ src/greenlet/greenlet_greenlet.hpp:210:21: warning: inline function ‘bool greenlet::StackState::main() const’ used but never defined [enabled by default] inline bool main() const G_NOEXCEPT; ^ In file included from src/greenlet/greenlet_greenlet.hpp:11:0, from src/greenlet/greenlet_internal.hpp:20, from src/greenlet/greenlet.cpp:19: src/greenlet/greenlet_refs.hpp:181:19: warning: inline function ‘T* greenlet::refs::PyObjectPointer<T, <anonymous> >::borrow() const [with T = _greenlet; void (* TC)(void*) = greenlet::refs::GreenletChecker]’ used but never defined [enabled by default] inline T* borrow() const G_NOEXCEPT ^ error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-30998ynj/greenlet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-jfkgxde5-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-30998ynj/greenlet/ 还是报错,Python.h再文件夹中可以看到
最新发布
07-23
D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:13: error: class 'view::equipment::kchangemanage' does not have any field named 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In constructor 'view::equipment::kchangemanage::kchangemanage(QWidget*)': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:13:7: error: class 'view::equipment::kchangemanage' does not have any field named 'm_model' 13 | , m_model(nullptr) // 初始化模型指针 | ^~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:14: error: class 'view::equipment::kchangemanage' does not have any field named 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:14:7: error: class 'view::equipment::kchangemanage' does not have any field named 'm_currentMatchIndex' 14 | , m_currentMatchIndex(-1) { // 初始化匹配索引 | ^~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27: error: no declaration matches 'void view::equipment::kchangemanage::setModel(QAbstractItemModel*)' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: At global scope: D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27:6: error: no declaration matches 'void view::equipment::kchangemanage::setModel(QAbstractItemModel*)' 27 | void kchangemanage::setModel(QAbstractItemModel *model) { | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27:6: note: no functions named 'void view::equipment::kchangemanage::setModel(QAbstractItemModel*)' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:1: In file included from D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:1: In file included from D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:1: D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.h:15:7: note: 'class view::equipment::kchangemanage' defined here 15 | class kchangemanage : public QDialog { | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:45: error: 'm_matchedRows' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In member function 'void view::equipment::kchangemanage::on_find_clicked()': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:45:5: error: 'm_matchedRows' was not declared in this scope 45 | m_matchedRows.clear(); // 清空历史匹配结果 | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:46: error: 'm_currentMatchIndex' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:46:5: error: 'm_currentMatchIndex' was not declared in this scope 46 | m_currentMatchIndex = -1; | ^~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:48: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:48:10: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 48 | if (!m_model) { | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:55: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:55:29: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 55 | for (int row = 0; row < m_model->rowCount(); ++row) { | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:70: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:70:31: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 70 | QModelIndex targetIndex = m_model->index(m_matchedRows.first(), 0); | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:77: error: 'm_matchedRows' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In member function 'void view::equipment::kchangemanage::on_next_clicked()': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:77:9: error: 'm_matchedRows' was not declared in this scope 77 | if (m_matchedRows.isEmpty()) { | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82: error: 'm_currentMatchIndex' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82:5: error: 'm_currentMatchIndex' was not declared in this scope 82 | m_currentMatchIndex = (m_currentMatchIndex + 1) % m_matchedRows.size(); | ^~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82: error: 'm_matchedRows' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82:55: error: 'm_matchedRows' was not declared in this scope 82 | m_currentMatchIndex = (m_currentMatchIndex + 1) % m_matchedRows.size(); | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:83: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:83:31: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 83 | QModelIndex targetIndex = m_model->index(m_matchedRows[m_currentMatchIndex], 0); | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:90: error: 'm_matchedRows' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In member function 'void view::equipment::kchangemanage::on_before_clicked()': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:90:9: error: 'm_matchedRows' was not declared in this scope 90 | if (m_matchedRows.isEmpty()) { | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: 'm_currentMatchIndex' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95:5: error: 'm_currentMatchIndex' was not declared in this scope 95 | m_currentMatchIndex = (m_currentMatchIndex - 1 + m_matchedRows.size()) % m_matchedRows.size(); | ^~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: 'm_matchedRows' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95:54: error: 'm_matchedRows' was not declared in this scope 95 | m_currentMatchIndex = (m_currentMatchIndex - 1 + m_matchedRows.size()) % m_matchedRows.size(); | ^~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:96: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:96:31: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 96 | QModelIndex targetIndex = m_model->index(m_matchedRows[m_currentMatchIndex], 0); | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:121: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In member function 'void view::equipment::kchangemanage::on_change_clicked()': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:121:33: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 121 | QModelIndex nameIndex = m_model->index(row, nameColumn); | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: 'fliterModel' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129:40: error: 'fliterModel' was not declared in this scope 129 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: parse error in template argument list D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129:27: error: parse error in template argument list 129 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129:71: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 129 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:134: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:134:9: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 134 | if (m_model->submit()) { // 源模型提交到数据库 | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:163: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp: In member function 'void view::equipment::kchangemanage::on_deleteButton_clicked()': D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:163:14: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 163 | if (!m_model->removeRow(row)) { | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: 'fliterModel' was not declared in this scope D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170:40: error: 'fliterModel' was not declared in this scope 170 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: parse error in template argument list D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170:27: error: parse error in template argument list 170 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170:71: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 170 | if (auto proxyModel = qobject_cast<fliterModel::FilterProxyMdel*>(m_model)) { | ^~~~~~~ | modfl D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:175: error: 'm_model' was not declared in this scope; did you mean 'modfl'? D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:175:9: error: 'm_model' was not declared in this scope; did you mean 'modfl'? 175 | if (m_model->submit()) { | ^~~~~~~ | modfl mingw32-make.exe[2]:-1: *** [CMakeFiles\LabNexus.dir\build.make:269: CMakeFiles/LabNexus.dir/view/equipmentManage/kchangemanage.cpp.obj] Error 1 mingw32-make.exe[1]:-1: *** [CMakeFiles\Makefile2:114: CMakeFiles/LabNexus.dir/all] Error 2 mingw32-make.exe:-1: *** [Makefile:100: all] Error 2 D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:13: error: Member initializer 'm_model' does not name a non-static data member or base class D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:14: error: Member initializer 'm_currentMatchIndex' does not name a non-static data member or base class D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27: error: Out-of-line definition of 'setModel' does not match any declaration in 'view::equipment::kchangemanage' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:28: error: Use of undeclared identifier 'm_model'; did you mean 'model'? (fix available) D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27: 'model' declared here D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:29: error: Use of undeclared identifier 'm_model'; did you mean 'model'? (fix available) D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27: 'model' declared here D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:30: error: Use of undeclared identifier 'm_model'; did you mean 'model'? (fix available) D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:27: 'model' declared here D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:45: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:46: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:48: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:55: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:56: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:57: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:59: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:63: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:69: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:70: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:70: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:77: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:82: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:83: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:83: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:90: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:95: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:96: error: Use of undeclared identifier 'm_matchedRows' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:96: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:121: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:122: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: Use of undeclared identifier 'fliterModel' (fix available) D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: Expected expression D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:129: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:134: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:163: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: Use of undeclared identifier 'fliterModel' (fix available) D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: Expected expression D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:170: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:175: error: Use of undeclared identifier 'm_model' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:83: error: Use of undeclared identifier 'm_currentMatchIndex' D:\QT_PROGRAM\LabNexus\view\equipmentManage\kchangemanage.cpp:96: error: Use of undeclared identifier 'm_currentMatchIndex'
07-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值