Tag: visual studio 2010

在Python中编译C代码的问题

我在Windows 7,64位中使用Anaconda for Python 2.7.10。 我也使用Visual Studio 2010.我安装了Microsoft Visual Studio for Python。 当我尝试在python中编译C代码时(在cmd中): C:\Anaconda\sms-tools-master\software\transformations_interface>python compileModule.py build_ext –inplace 我得到了很多警告和一些错误,最后一部分如下: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\link.exe /DLL / nologo /INCREMENTAL:NO /LIBPATH:C:\Anaconda\libs /LIBPATH:C:\Anaconda\PCbuild\am d64 m.lib /EXPORT:initutilFunctions_C build\temp.win-amd64-2.7\Release\utilFunct ions.obj build\temp.win-amd64-2.7\Release\cutilFunctions.obj /OUT:C:\Anaconda\sm s-tools-master\software\models\utilFunctions_C\utilFunctions_C.pyd /IMPLIB:build \temp.win-amd64-2.7\Release\utilFunctions_C.lib /MANIFESTFILE:build\temp.win-amd 64-2.7\Release\utilFunctions_C.pyd.manifest LINK : fatal error LNK1181: cannot open input file ‘m.lib’ error: command ‘C:\\Program […]

从’void *’转换为指向非”’的指针需要显式转换(第17行)

我正在阅读“学习困难之路”一书,当我尝试运行此程序时,我收到以下错误消息: 从’void *’转换为指向非’void’的指针需要显式转换。 我不知道如何解决这个问题,我是否必须更改结构中的返回变量? 看看无论如何,这里的代码:(在Visual C ++ 2010上编译,还没有尝试过GCC)。 //learn c the hardway #include #include #include #include struct Person { char *name; int age; int height; int weight; }; struct Person *Person_create(char *name, int age, int height, int weight) { struct Person *who = malloc(sizeof(struct Person)); assert(who != NULL); who->name = strdup(name); who->age = age; who->height […]

在单个malloc()调用中创建2D数组

#include #include #define MAX_ROWS 5 #define MAX_COLS 5 int globalvariable = 100; void CreateMatrix(int ***Matrix) { int **ptr; char *cp; int i = 0; *Matrix = (int**)malloc((sizeof(int*) * MAX_ROWS) + ((MAX_ROWS * MAX_COLS)*sizeof(int))); ptr = *Matrix; cp = (char*)((char*)*Matrix + (sizeof(int*) * MAX_ROWS)); for(i =0; i < MAX_ROWS; i++) { cp = (char*)(cp + ((sizeof(int) […]

在C中,无符号和有符号字符指针之间的转换何时变得不安全?

如果我在clang和Visual Studio中都这样做: unsigned char *a = 0; char * b = 0; char x = ‘3’; a = & x; b = (unsigned char*) a; 我收到警告,我正在尝试在有符号和无符号字符指针之间进行转换,但代码确实有效。 虽然编译器说这是有原因的。 你能指出一个可能变成问题的情况吗?

MSVC中奇怪的编译器错误

我正在尝试WinFUSE库并得到一个奇怪的编译器错误消息。 #include #include void* fuse_init(struct fuse_conn_info* conn) { printf(“%s(%p)\n”, __FUNCTION__, conn); if (!conn) return NULL; conn->async_read = TRUE; conn->max_write = 128; conn->max_readahead = 128; return conn; } int main(int argc, char** argv) { struct fuse_operations ops = {0}; // Fill the operations structure. ops.init = fuse_init; // REFLINE 1 void* user_data = NULL; // REFLINE […]

在Visual Studio中写入文件时出错

Unhandled exception at 0x102e1cee (msvcr100d.dll) in filename.exe 0xC0000005: Access violation writing location 0x00416858 on. 调试指向行: if (_putc_nolock(ch, f) == EOF) 代码 #else /* _UNICODE */ if (_putc_nolock(ch, f) == EOF) #endif /* _UNICODE */ *pnumwritten = -1; else ++(*pnumwritten); } 在output.c中我相信它是在visual studio库中链接的。 我没有链接它。 我的代码是: body=”” myFile=CreateFile(“Sample.txt”,FILE_APPEND_DATA,FILE_SHARE_WRITE,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); BufferNo=sprintf(body,”%.5f %[3].5f %[3].5f %[3].5f %[3].5f %[3].5f %[3].5f %[3].5f \n”,a1,a2,a3,a4,a5,a6,a7,a8); […]

VS2010中“无法打开包含文件”错误

我正在尝试编译开源工具“abc”。 当我尝试构建解决方案文件时,我收到了很多错误消息。 c源代码有include指令,而VS2010找不到头文件。 文件结构如下。 #include “src/misc/util/abc_global.h” #include “pr.h” 在项目属性中,我尝试添加$(SolutionDir)和$(ProjectDir),但它不起作用。 可能有什么问题?

正向声明一个extern结构

在我开始之前: 请注意 , 我不想改变我在这里展示的主要设计。 如果您认为这个不适合,请随意更改标题 C ++标签在这里,因为解决方案也应该是等效的 我有一个标题breakpoints.h ,它声明: typedef struct BreakpointInfo BreakpointInfo; /* * Iterate all breakpoints known to the Breakpoints service, * including breakpoints that are created by other (remote) clients. */ typedef void IterateBreakpointsCallBack(BreakpointInfo *, void *); extern void iterate_breakpoints(IterateBreakpointsCallBack * callback, void * args); 和相应的breakpoints.c定义: struct BreakpointInfo { Context * ctx; […]

断言失败在未知函数中../../ocv/opencv/modules/imgproc/src/imgwarp.cpp

嘿,请有人帮我找到这个错误的解决方案: 断言在未知函数中失败../../ocv/opencv/modules/imgproc/src/imgwarp.cpp 我尝试编译此链接中存在的代码: http : //ipwithopencv.googlecode.com/svn/trunk/ThinPlateSpline/ThinPlateSpline/ 即时通讯使用2个类和主要: 这是我的主要代码: #include “stdafx.h” #include #include #include #include “CThinPlateSpline.h” #include “iostream” using namespace std; int _tmain(int argc, _TCHAR* argv[]) { // load a nice picture cv::Mat img = cv::imread(“lena.jpg”); // generate some generic points // usually you would use a interest point detector such as SURF or SIFT std::vector […]

OpenCv在Visual Studio中未解决外部符号错误

我已链接到我想要使用的库,并将头文件添加到我的项目中。 并且代码在红色波形中没有显示任何错误,但是当我尝试运行它时,它给出了以下错误: Error 1 error LNK2001: unresolved external symbol _cvDestroyWindow C:\Users\Jos\documents\visual studio 2010\Projects\ocv\ocv\opcv.obj ocv Error 2 error LNK2001: unresolved external symbol _cvWaitKey C:\Users\Jos\documents\visual studio 2010\Projects\ocv\ocv\opcv.obj ocv Error 3 error LNK2001: unresolved external symbol _cvNamedWindow C:\Users\Jos\documents\visual studio 2010\Projects\ocv\ocv\opcv.obj ocv Error 4 error LNK2001: unresolved external symbol _cvLoadImage C:\Users\Jos\documents\visual studio 2010\Projects\ocv\ocv\opcv.obj ocv Error 5 error LNK2001: unresolved […]