Tag: visual studio 2010

如何使用Visual Studio 2010编译64位C DLL?

我在源代码中用C编写了一个DLL。 这是General Polygon Clipper的代码(如果您感兴趣的话)。 我通过主页上提供的C#包装器在C#项目中使用它。 这附带一个预编译的DLL。 自从使用Visual Studio 2010和Windows 7 64位切换到64位开发机器后,该应用程序将不再运行。 这是我得到的错误: 尝试加载格式不正确的程序。 这是因为DLLImport 32bit gpc.dll ,因为我从网上找到的东西收集。 我假设如果我将DLL重新编译为64位,这一切都会消失,但不能因为我的爱而弄清楚如何这样做。 我的C技能是基本的,因为我可以用GNU工具编写C程序,但没有使用各种编译器/处理器/ IDE等经验。 我相信我可以把它移植到C#。 我的意思是我相信自己真的能把它拉下来。 但我不愿意,因为我需要编译器为我做很多工作;)

Visual Studio C ++与psapi.lib的链接

我编写了一个C程序,它调用psapi.h中定义的函数GetModuleInformation() 我正在使用Microsoft Visual Studio C ++命令行编译器(cl.exe)来编译和链接程序。 我已经包含了psapi.h头文件: #include 当我尝试编译时使用: cl program.c 它生成目标文件,但在链接阶段失败并出现错误: program.obj : error LNK2019: unresolved external symbol _GetModuleInformation@16 ref erenced in function _main program.exe : fatal error LNK1120: 1 unresolved externalsprogram.obj : error LNK2019: unresolved external symbol _GetModuleInformation@16 ref 我还将psapi.lib文件放在放置源代码文件(program.c)的同一文件夹中,但即便如此,我也会收到与上面相同的错误消息。 如何使用命令行编译器(cl.exe)成功链接它?

在Visual Studio 2010中是否有64位的#define?

是否有#define指示Visual Studio是否在64位模式下进行编译? 我希望能够有条件地包含一些代码 #ifdef _IS_64BIT … #else //32 bit … #endif 我知道我可以自己创建一个标志,但我想知道编译器是否提供了一个标志。

从cuda内核打印

我正在编写一个cuda程序,并尝试使用printf函数在cuda内核中打印一些内容。 但是当我编译程序时,我收到了一个错误 error : calling a host function(“printf”) from a __device__/__global__ function(“agent_movement_top”) is not allowed error MSB3721: The command “”C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” -gencode=arch=compute_10,code=\”sm_10,compute_10\” –use-local-env –cl-version 2008 -ccbin “c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin” -I”C:\ProgramData\NVIDIA Corporation\NVIDIA GPU Computing SDK 4.2\C\common\inc” -I”C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\include” -G –keep-dir “Debug” -maxrregcount=0 –machine 32 –compile -g -Xcompiler […]

C中的错误消息

我在编译C应用程序时遇到问题,显示的错误毫无意义。 我不知道从哪里开始寻找解决方案。 这是代码: static char* FilterCreate( void* arg, const char* const* key_array, const size_t* key_length_array, int num_keys, size_t* filter_length) { *filter_length = 4; char* result = malloc(4); // error: error C2143: syntax error : missing ‘;’ before ‘type’ C:\Projects\myleveldb\db\c_test.c memcpy(result, “fake”, 4); return result; } 这是全屏截图: 什么可能导致这样的错误?

将C文件添加到Visual Studio

我正在使用Microsoft Visual Studio 2010.当我向项目添加文件时,它们的扩展名为.cpp 。 要使用C,我必须手动将文件重命名为.c 。 有没有办法直接添加C文件,而无需重命名任何东西?

为Visual Studio安装openCV 2.4 for C / C ++

我一直在尝试在Windows 7 for C / C ++上为Visual Studio 2010安装OpenCV(版本2.4.1和2.4.2)。 我一直在关注这个教程: http : //docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html 我跳过安装第三方软件(除了python 2.7和zlib,来自这里: http : //gnuwin32.sourceforge.net/packages/zlib.htm )。 我运行cmake,然后从openCV构建目录中打开openCV.sln,等待visual studio加载然后构建它。 Visual Studio提供了200个错误,这些错误只是以下两次重复多次: 错误C1083:无法打开包含文件:’unistd.h’:没有这样的文件或目录 错误LNK1104:无法打开文件’…. \ lib \ Debug \ opencv_core241d.lib’ “OpenCV构建目录”/ bin / Release不包含任何* .exe文件,只有大量* .pdb文件,其中我可以看到contours.pdb。 教程说我应该在那里看到contours.exe。 由于没有* .exe文件,我理解在构建过程中遇到的两个错误是至关重要的。 我会很感激能帮助我解决问题的任何想法。

这些Visual Studio 2010错误和警告的原因是什么?

我不知道从Visual Studio 2010收到这些错误的原因。 这是我的程序从第343行到第408行的代码: int create_den_from_img(char *img_file_name_part, int xlen, int ylen, int zlen ) { IplImage* imgs = 0; char str[80]; unsigned char *data,*imgdata; /* allocating memory */ data = (unsigned char *) malloc(xlen * ylen * zlen * sizeof(unsigned char) ); if(data==NULL) { printf(“error in allocating memory \n”); exit(1); } /* Getting the filename […]

Visual Studio 2010 Intellisense对C代码进行了波动

Visual Studio 2010中的Intellisense将C代码解释为C ++,并将错误标记为不存在,如: struct my_struct *s = malloc(sizeof *s); 这是有效的C,但不是有效的C ++。 有没有什么办法解决这一问题?

如何从Google代码库调试源代码

我想从谷歌代码库调试以下源代码, http://code.google.com/p/rx/ 我的问题是,我无法找到一个合适的ide,它可以将源代码中的所有子文件夹视为一个完整的项目。 我尝试过netbeans C ++,codeblocks,eclipse C ++等。 打开项目时所有这些问题都是他们将主项目中的所有子文件夹视为不同的项目。 是否有任何ide可用于从谷歌代码库调试源代码。 或者是否有任何方式调试这些项目? 操作系统:Ubuntu或Windows