草庐IT

external_deps

全部标签

c++ - C++0x 是否支持 __stdcall 或 extern "C"capture-nothing lambdas?

昨天我在考虑是否可以使用C++0xlambda函数的便利性来为WindowsAPI函数编写回调。例如,如果我想使用lambda作为EnumChildProc怎么办?与EnumChildWindows?比如:EnumChildWindows(hTrayWnd,CALLBACK[](HWNDhWnd,LPARAMlParam){//...returnstatic_cast(TRUE);//continueenumerating},reinterpret_cast(&myData));另一个用途是为C例程编写extern"C"回调。例如:my_class*pRes=static_cast(b

c++ - C++0x 是否支持 __stdcall 或 extern "C"capture-nothing lambdas?

昨天我在考虑是否可以使用C++0xlambda函数的便利性来为WindowsAPI函数编写回调。例如,如果我想使用lambda作为EnumChildProc怎么办?与EnumChildWindows?比如:EnumChildWindows(hTrayWnd,CALLBACK[](HWNDhWnd,LPARAMlParam){//...returnstatic_cast(TRUE);//continueenumerating},reinterpret_cast(&myData));另一个用途是为C例程编写extern"C"回调。例如:my_class*pRes=static_cast(b

c++ - 如何防止 extern "C"函数过载?

我正在编写一个c++库,它公开了一些仅由C#代码使用的函数。但是,由于我不小心打错了参数,我发现只要不使用cpp文件中的(notmistypedversion)函数,即使没有任何警告,这段代码也可以成功编译和链接。structDummy{inta;doubleb;};extern"C"voidSetArray(Dummy*x,intcnt);voidSetArray(Dummyx,intcnt){//aTODOplaceholder.}如何让编译器针对这种情况抛出错误或警告?编译器选项-Wall已设置,但仍然没有警告。使用tdmgcc5.1.0。 最佳答案

c++ - 如何防止 extern "C"函数过载?

我正在编写一个c++库,它公开了一些仅由C#代码使用的函数。但是,由于我不小心打错了参数,我发现只要不使用cpp文件中的(notmistypedversion)函数,即使没有任何警告,这段代码也可以成功编译和链接。structDummy{inta;doubleb;};extern"C"voidSetArray(Dummy*x,intcnt);voidSetArray(Dummyx,intcnt){//aTODOplaceholder.}如何让编译器针对这种情况抛出错误或警告?编译器选项-Wall已设置,但仍然没有警告。使用tdmgcc5.1.0。 最佳答案

c++ - 是否有任何理由在没有方法的 header 上使用 extern "C"?

我经常遇到包含extern"C"保护的C头文件,但不包含任何实际功能。例如:/*b_ptrdiff.h-basetypeptrdiff_tdefinitionheader*/#ifndef__INCb_ptrdiff_th#define__INCb_ptrdiff_th#ifdef__cplusplusextern"C"{#endif#ifndef_PTRDIFF_T#define_PTRDIFF_Ttypedeflongptrdiff_t;#endif/*_PTRDIFF_T*/#ifdef__cplusplus}#endif#endif/*__INCb_ptrdiff_th*/我知

c++ - 是否有任何理由在没有方法的 header 上使用 extern "C"?

我经常遇到包含extern"C"保护的C头文件,但不包含任何实际功能。例如:/*b_ptrdiff.h-basetypeptrdiff_tdefinitionheader*/#ifndef__INCb_ptrdiff_th#define__INCb_ptrdiff_th#ifdef__cplusplusextern"C"{#endif#ifndef_PTRDIFF_T#define_PTRDIFF_Ttypedeflongptrdiff_t;#endif/*_PTRDIFF_T*/#ifdef__cplusplus}#endif#endif/*__INCb_ptrdiff_th*/我知

C++ vector 问题 - 'LNK2001: unresolved external symbol private: static...'

在有人指责我不查看预先存在的问题之前,我已经查看并意识到它与声明有关,但我仍然无法让它工作(可能与我使用vector有关)。Manager.h:#include"Flight.h"#ifndefmanager_h#definemanager_hclassManager{staticvectorairports;staticvectorflights;public:staticvoidloadAirports();staticvoidloadFlights();staticAirportgetAirport(stringcode);staticvectorsplit(conststrin

C++ vector 问题 - 'LNK2001: unresolved external symbol private: static...'

在有人指责我不查看预先存在的问题之前,我已经查看并意识到它与声明有关,但我仍然无法让它工作(可能与我使用vector有关)。Manager.h:#include"Flight.h"#ifndefmanager_h#definemanager_hclassManager{staticvectorairports;staticvectorflights;public:staticvoidloadAirports();staticvoidloadFlights();staticAirportgetAirport(stringcode);staticvectorsplit(conststrin

c++ - 错误 LNK2019 : unresolved external symbol _main referenced in function ___tmainCRTStartup, 但这次不是 Windows/控制台问题!

所以,臭名昭著的错误又回来了。该项目提示它找不到main()方法(这就是错误的意思,对)。但是我确实有一个主项目,而且我的项目应该是一个控制台项目。它以前有效,所以我知道不是那样。此外,该项目有太多的类和文件,我无法将它们全部发布,所以我会根据您的要求发布您需要的任何类。这是VisualStudio2010上的C++、OpenGL和SDL游戏。这不是任何库的问题,因为它在突然莫名其妙地显示此链接器错误之前运行良好。编辑:main()方法:intmain(intargc,char**argv){glutInit(&argc,argv);glutInitDisplayMode(GLUT_D

c++ - 错误 LNK2019 : unresolved external symbol _main referenced in function ___tmainCRTStartup, 但这次不是 Windows/控制台问题!

所以,臭名昭著的错误又回来了。该项目提示它找不到main()方法(这就是错误的意思,对)。但是我确实有一个主项目,而且我的项目应该是一个控制台项目。它以前有效,所以我知道不是那样。此外,该项目有太多的类和文件,我无法将它们全部发布,所以我会根据您的要求发布您需要的任何类。这是VisualStudio2010上的C++、OpenGL和SDL游戏。这不是任何库的问题,因为它在突然莫名其妙地显示此链接器错误之前运行良好。编辑:main()方法:intmain(intargc,char**argv){glutInit(&argc,argv);glutInitDisplayMode(GLUT_D