编译器错误,我无法找到

我收到一个我无法解决的错误。 我彻底完成了我的代码但没有成功。 我究竟做错了什么? 见下面的代码。 编译错误: In function ‘main’: ou1.c:49:1: error: expected ‘while’ before ‘printf’ printf(“End of program!\n”); ^ 我的代码: #include int main(void){ int choice; float price, sum, SUMusd; float rate =1; printf(“Your shopping assistant”); do{ printf(“1. Set exchange rate in usd (currency rate:%f)\n”, rate); printf(“2. Read prices in the foreign currency\n”); printf(“3. End\n”); printf(“\n”); scanf(“%d”, […]

LibVLC空图像

我正在尝试使用LibVLC解码video文件并将其渲染为纹理。 打开和开始播放的代码工作,音频播放完美,但像素缓冲区始终填充0xCD。 我尝试在VLC上渲染的video,甚至在C#实现中我都做到了,但是CI中的这个新代码无法让它工作…… 我正在使用x64版本的vlc库,如果这有任何区别,程序将编译为x64。 这是我的代码: #include “stdafx.h” #include “video.h” #include #include #include #include libvlc_instance_t* instance; libvlc_media_t* media; libvlc_media_player_t* player; struct videoContext { unsigned char *pixeldata; unsigned char currentFrame; int width; int height; }; struct videoContext mainContext; bool gotData = false; int width; int height; static void *lock(void *data, void **p_pixels) { videoContext* context = (videoContext*)data; […]

无法配置交流编译器

我正在尝试使用gcc 4.7编译一些库(我刚从4.6.3升级,不知何故它抱怨c编译器: /home/rtbkit/platform-deps/node/wscript:263: error: could not configure ac compiler! make[1]: Entering directory `/home/rtbkit/platform-deps/node’ Project not configured (run ‘waf configure’ first) make[1]: *** [program] Error 1 make[1]: Target `all’ not remade because of errors. make[1]: Leaving directory `/home/rtbkit/platform-deps/node’ make[1]: Entering directory `/home/rtbkit/platform-deps/node’ Project not configured (run ‘waf configure’ first) make[1]: *** [program] Error 1 make[1]: Target […]

如何从链表中弹出元素?

我正在尝试使用各种推送和弹出function来学习链表,但我无法从链表中的尾部弹出元素。 任何人都可以帮我解决popBackfunction吗? 我尝试过类似的东西: typedef struct { float val; }data; typedef struct nodePtr { struct nodePtr *next; data *d; }node; typedef struct { node *head; node *tail; }linkList; linkList* createlinkList() { linkList *ll = (linkList*)malloc(sizeof(linkList)); ll->head = NULL; ll->tail = NULL; return ll; } node* createNode(data *d) { node *nd = (node*)malloc(sizeof(node)); nd-> d = d; […]

从C中的结构返回值的函数

我在C语言中有这个结构。 struct webit{ char indice[10]; int prid; double latitude; char date[20]; double longitude; int xspeed; int rEvt; int alti; int seq1; int seq2; int presi; char cod1[5]; char cod2[5]; int iint1; int iint2; int x15; }; 我已经在struct webit之前推出了这个函数 tramafunction(); 这是函数的工作方式:接收一个用逗号分隔的字符串,然后将数据拆分为15个不同的变量,这是一个字符串的示例: /*¶bL0 L3,01,+08590323,-079343001,010215,00000000000000,-tN,000,012689997,001219456,000,7FF2,C07F,0,4,*/ function: trama function(){ struct webit wbt; char buf[103]=””; scanf(“%[^\t\n]s”,buf); printf(“\n \n Trama Recibida=[%s]\n\n”, […]

MPI发送和接收不能超过8182倍

我遇到以下代码的麻烦: int main(int argc, char *argv[]){ int id, p, n, ln, i, j, retCode; double *buffer; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &p); MPI_Comm_rank(MPI_COMM_WORLD, &id); n = strtol(argv[1],NULL,10); // total number of elements to be distributed ln = n/p; // local number of elements buffer = (double*)calloc(ln, sizeof(double)); if (id == p-1) // Process p-1 send to other […]

使用文本文件二

关于以下代码的几个问题,我在之前的post中获得了帮助。 1)。 任何想法为什么在输出结束时,我得到一个随机的垃圾字符打印? 我正在释放文件等并检查EOF。 2)。 这个想法是它可以使用多个文件争论,所以我想创建新的文件名,增加,即out [i] .txt,是否可能在C? 代码本身接受一个文件,其中包含所有用空格分隔的单词,例如书籍,然后循环遍历,并用\ n替换每个空格以便它形成一个列表,请找到下面的代码: #include #include #include #include /* * */ int main(int argc, char** argv) { FILE *fpIn, *fpOut; int i; char c; while(argc–) { for(i = 1; i <= argc; i++) { fpIn = fopen(argv[i], "rb"); fpOut= fopen("tmp.out", "wb"); while (c != EOF) { c = fgetc(fpIn); […]

如何在fgets中使用feof和ferror(C中的minishell)

我写过这个minishell,但我不确定我是否正确控制错误。 我知道fgets可以返回feof和ferror( http://www.manpagez.com/man/3/fgets/ ),但我不知道如何使用它们。 我已经检查过fgets是否返回一个空指针(表示缓冲区的内容是inditerminate),但我想知道如何使用feof和ferror。 #include #include #include #include #define LINE_LEN 50 #define MAX_PARTS 50 int main () { char* token; char str[LINE_LEN]; char* arr[MAX_PARTS]; int i,j; bool go_on = true; while (go_on == true){ printf(“Write a line:(‘quit’ to end) \n $:”); fgets(str, LINE_LEN, stdin); if (str==NULL) { goto errorfgets; } else { size_t l=strlen(str); […]

使用CSparse库在C中表示稀疏矩阵

我无法理解如何使用CSparese库轻松表示C中的稀疏矩阵。 这就是我想要的 | 6.0 0.0 2.0 | A = | 3.0 8.0 0.0 | | 6.0 0.0 1.0 | with | 40.0 | b = | 50.0 | | 30.0 | csparse的cs Struct就是这个 typedef struct cs_sparse /* matrix in compressed-column or triplet form */ { csi nzmax ; /* maximum number of entries */ csi […]

打开外部程序

我一直试图在C中打开像编辑器这样的外部程序。我已经搜索了几个小时但没有找到打开外部可执行文件的方法,例如从控制台应用程序打开Skype等。 到目前为止这是我的代码: /* fopen1.c */ #include #include #include #include int main(int) { FILE *fp; fp = fopen(“C://Users/Jonte/Desktop/Skype.exe”, “r”); } 如何打开外部文件? 谢谢,真诚的,贝林