A cycle was detected in the build path of project:

本文介绍了解决Eclipse中因Java工程间循环引用导致的编译错误的方法。通过调整Eclipse的设置,将循环依赖从错误级别改为警告级别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

解决Eclipse中Java工程间循环引用而报错的问题
如果我们的项目包含多个工程(project),而它们之间又是循环引用的关系,那么Eclipse在编译时会抛出如下一个错误信息:
“A cycle was detected in the build path of project: XXX”
解决方法非常简单:
Eclipse Menu -> Window -> Preferences... -> Java -> Compiler -> Building -> Building path problems -> Circular dependencies -> 将Error改成Warning。

#include <stdio.h> #include <stdlib.h> #pragma pack(push, 1) typedef struct { unsigned short bfType; unsigned int bfSize; unsigned short bfReserved1; unsigned short bfReserved2; unsigned int bfOffBits; } BITMAPFILEHEADER; typedef struct { unsigned int biSize; unsigned int biWidth; unsigned int biHeight; unsigned short biPlanes; unsigned short biBitCount; unsigned int biCompression; unsigned int biSizeImage; unsigned int biXPelsPerMeter; unsigned int biYPelsPerMeter; unsigned int biClrUsed; unsigned int biClrImportant; } BITMAPINFOHEADER; #pragma pack(pop) // C6000兼容的周期计数函数 unsigned long long get_cycle_count() { unsigned int tsch, tscl; asm(" mvc .s2 TSCH, %0" : "=r"(tsch)); asm(" mvc .s2 TSCL, %0" : "=r"(tscl)); return ((unsigned long long)tsch << 32) | tscl; } int main(void) { const int width = 768, height = 576; const int sizeImage = width * height * 3; const int iterations = 1000; const char *src1_path = "HazyDay1.bmp"; const char *src2_path = "HazyDay2.bmp"; const char *dst_path = "jieguo.bmp"; printf("Starting image processing on C6000 DSP...\n"); printf("Image size: %dx%d, Iterations: %d\n", width, height, iterations); FILE *src1 = fopen(src1_path, "rb"); FILE *src2 = fopen(src2_path, "rb"); FILE *dst = fopen(dst_path, "wb"); if (!src1 || !src2 || !dst) { printf("Error opening files\n"); if (src1) fclose(src1); if (src2) fclose(src2); if (dst) fclose(dst); return -1; } BITMAPFILEHEADER fileHeader; BITMAPINFOHEADER infoHeader; if (fread(&fileHeader, sizeof(BITMAPFILEHEADER), 1, src1) != 1 || fread(&infoHeader, sizeof(BITMAPINFOHEADER), 1, src1) != 1) { printf("Error reading BMP headers\n"); fclose(src1); fclose(src2); fclose(dst); return -1; } unsigned char *img1 = (unsigned char *)malloc(sizeImage); unsigned char *img2 = (unsigned char *)malloc(sizeImage); unsigned char *result = (unsigned char *)malloc(sizeImage); if (!img1 || !img2 || !result) { printf("Memory allocation failed\n"); free(img1); free(img2); free(result); fclose(src1); fclose(src2); fclose(dst); return -1; } fseek(src1, fileHeader.bfOffBits, SEEK_SET); fseek(src2, fileHeader.bfOffBits, SEEK_SET); fread(img1, 1, sizeImage, src1); fread(img2, 1, sizeImage, src2); unsigned long long start_cycles, end_cycles; double total_time_3ch = 0, total_time_1ch = 0; int i, iter; // ================= 三通道同时处理 ================= printf("Running 3-channel method...\n"); start_cycles = get_cycle_count(); for (iter = 0; iter < iterations; iter++) { unsigned char *p1 = img1; unsigned char *p2 = img2; unsigned char *res = result; for (i = 0; i < sizeImage; i++) { *res++ = (*p1++ + *p2++) >> 1; } } end_cycles = get_cycle_count(); total_time_3ch = (double)(end_cycles - start_cycles); // ================= 单通道分别处理 ================= printf("Running 1-channel method...\n"); start_cycles = get_cycle_count(); for (iter = 0; iter < iterations; iter++) { for (i = 0; i < sizeImage; i += 3) { result[i] = (img1[i] + img2[i]) >> 1; result[i+1] = (img1[i+1] + img2[i+1]) >> 1; result[i+2] = (img1[i+2] + img2[i+2]) >> 1; } } end_cycles = get_cycle_count(); total_time_1ch = (double)(end_cycles - start_cycles); // 输出结果 printf("\nProcessing Time Comparison (after %d iterations):\n", iterations); printf("3-Channel Method:\n"); printf(" Total cycles: %.0f\n", total_time_3ch); printf(" Average cycles: %.0f\n", total_time_3ch/iterations); printf("1-Channel Method:\n"); printf(" Total cycles: %.0f\n", total_time_1ch); printf(" Average cycles: %.0f\n", total_time_1ch/iterations); if (total_time_1ch > 0 && total_time_3ch > 0) { double improvement = (total_time_1ch - total_time_3ch) / total_time_1ch * 100; printf("Efficiency Improvement: %.2f%% (%s method is faster)\n", fabs(improvement), improvement > 0 ? "3-channel" : "1-channel"); } // 写入结果 fwrite(&fileHeader, sizeof(BITMAPFILEHEADER), 1, dst); fwrite(&infoHeader, sizeof(BITMAPINFOHEADER), 1, dst); fseek(dst, fileHeader.bfOffBits, SEEK_SET); fwrite(result, 1, sizeImage, dst); // 释放资源 free(img1); free(img2); free(result); fclose(src1); fclose(src2); fclose(dst); return 0; } 为什么有下面的报错 **** Build of configuration Debug for project lab_03_app **** "G:\\ccs\\CCS5.5.0.00077_win32\\ccsv5\\utils\\bin\\gmake" -k all 'Building file: ../main.c' 'Invoking: C6000 Compiler' "G:/ccs/CCS5.5.0.00077_win32/ccsv5/tools/compiler/c6000_7.4.4/bin/cl6x" -mv6740 --abi=coffabi -g --include_path="G:/ccs/CCS5.5.0.00077_win32/ccsv5/tools/compiler/c6000_7.4.4/include" --display_error_number --diag_warning=225 --diag_wrap=off --preproc_with_compile --preproc_dependency="main.pp" "../main.c" "../main.c", line 31: error #18: expected a ")" "../main.c", line 32: error #18: expected a ")" "../main.c", line 33: warning #551-D: variable "tsch" is used before its value is set "../main.c", line 33: warning #551-D: variable "tscl" is used before its value is set 2 errors detected in the compilation of "../main.c". >> Compilation failure gmake: *** [main.obj] Error 1 gmake: Target `all' not remade because of errors. **** Build Finished ****
最新发布
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值