草庐IT

lib_main

全部标签

c++ - OpenGL32.lib 链接不正确

这个问题在这里已经有了答案:Whatisanundefinedreference/unresolvedexternalsymbolerrorandhowdoIfixit?(38个答案)关闭7年前。出于某种原因,我的OpenGL库文件没有正确链接到VisualStudio2013。这是我所有的代码:#include#include#include#include#include#include#pragmacomment(lib,"OpenGL32.lib")#pragmacomment(lib,"glu32.lib")#pragmacomment(lib,"freeglut.lib")

C++ std lib <mutex>, <conditional_variable> 库和共享内存

如果您想在共享内存中的进程之间共享互斥体,POSIX线程的CAPI需要设置一个特殊标志-请参阅sem_init()。我真的不知道差异是什么,但我在尝试在共享内存中使用C++std::condition_variable时遇到了问题——它的段错误。我在C++文档或构造函数中看不到任何提及此内容的内容。我想知道如何/是否可以在共享内存中使用C++线程互斥锁。这是我的测试代码供引用。注意squeue只是一个简单的(POD)静态大小的循环队列,省略了不相关的内容:#include#include#include/*Formodeconstants*/#include/*ForO_*consta

c++ - 在通过在 main 中声明数组来解决之前,数组绑定(bind)不是整数常量

程序1#includestd::size_tthree(){return3;}inti[three()];intmain(){return0;}方案二std::size_tthree(){return3;}intmain(){inti[three()];return0;}这里的问题是程序1如预期的那样给出了编译错误"error:arrayboundisnotanintegerconstantbefore']'token"但是不知道为什么程序2编译成功了? 最佳答案 C99允许inti[three()];声明一个变长数组,但只允许if

c++ - "If you' 已经写了一个编译测试,你've written a call to main"

在程序中调用mainviolatesC++标准voidf(){main();//anendlessloopcallingmain?Nothat'snotallowed}intmain(){staticint=0;std::cout在lecture中ChandlerCarruth,大约在“22.40”说ifyou'vewrittenacompilertestyou'vewrittenacalltomain这有什么关系,或者如何克服标准不允许的事实? 最佳答案 这里的要点是,如果你编写编译器测试代码,你可能会想用一些不同的参数集测试调用

c++ - 如何在 CMake 的 CXX_FLAGS 中包含 `pkg-config --cflags --libs gtk+-2.0`

这是Makefile中的CFLAGS。CFLAGS=-I/usr/include/libglade-2.0-I/usr/include/gsl`pkg-config--cflags--libsgtk+-2.0`-lglade-2.0-lglut-I/usr/local/include/dc1394-ldc1394我想使用CMAKE而不是Makefile。这部分是我写的CMakeLists.txt文件。find_package(PkgConfigREQUIRED)pkg_check_modules(GTKREQUIRED"gtk+-2.0")#Addthepathtoitsheaderf

c++ - 如何在 Visual Studio 2008 中使用 .a lib 文件?

所以我将一些C/C++库编译成.a文件。图书馆是ffmpeg(52).任何人都可以向我提供有关如何在visualstudio2008中使用它的详细说明(如何将它链接到VS以便编译器找到它等等)? 最佳答案 这可能有用:FromMinGWstaticlibrary(.a)toVisualStudiostaticlibrary(.lib) 关于c++-如何在VisualStudio2008中使用.alib文件?,我们在StackOverflow上找到一个类似的问题:

c++ - 使 main() "uncrashable"

我想编写一个守护进程管理器来确保所有守护进程都在运行,就像这样(简化的伪代码):voidwatchMe(filename){while(true){system(filename);//freezesaslongasfilenameruns//oh,filenamemustbecrashed.Nevermind,willberestarted}}intmain(){_beginThread(watchMe,"foo.exe");_beginThread(watchMe,"bar.exe");}这部分已经在工作了——但现在我面临的问题是,当观察到的应用程序——比如foo.exe——崩溃时

c++ - 无法打开输入文件 'opencv_calib3d243d.lib'

我在OpenCV中得到以下错误1>------Buildstarted:Project:OpenCv,Configuration:DebugWin32------1>LINK:fatalerrorLNK1181:cannotopeninputfile'opencv_calib3d243d.lib'==========Build:0succeeded,1failed,0up-to-date,0skipped==========我正在使用MSVisualStudio2010express和OpenCV2.4.0版。在配置OpenCV并使用提供的代码进行测试时,我遵循了以下说明。Instal

c++ - g++ 链接问题 : In function `_start' : (. text+0x20): undefined reference to `main'

我收到对主要错误的undefinedreference-即使我已经定义了主要,并且(AFAICT),我已经正确链接了它。这是我的代码和我使用的命令://################################################//proj1.h#ifndef__SCRATCH_PROJ1_H#define__SCRATCH_PROJ1_HintaddOne(inti);#endif/*__SCRATCH_PROJ1_H*///################################################//proj1.cpp#include"pr

c++ - 使用 -g 选项编译但 "Single stepping until exit from function main, which has no line number information"

我在使用gdb时遇到了一些问题。这是我在一个名为main.cpp的文件中的代码#includevoidmyfunc();intmain(){charmsg[]="HelloWorld!";myfunc();std::cout我使用这个命令来编译这段代码:g++-g-Wallmain.cpp-ofoo接下来,我使用了gdb:$gdbfoo(gdb)startTemporarybreakpoint1at0x80487c3Startingprogram:/home/laptop/workspace/fooTemporarybreakpoint1,0x080487c3inmain()(gdb)