Tag: 链接器错误

错误LNK1561:必须定义入口点

我正在使用Visual Studio 2012。 我的解决方案有3个项目 了projectA 项目B 项目C 而层次结构就像 projectC依赖于projectB ,而projectB又取决于projectA 。 projectC中有一个main函数 ,projectB和projectA中没有main。 我得到的错误是: error LNK1561: entry point must be defined projectA error LNK1561: entry point must be defined projectB 我已尝试在配置属性 – >链接器 – >系统 – >子系统更改为控制台(/ SUBSYSTEM:CONSOLE)但问题仍然存在 帮助我解决这个问题。

使用gcc,我无法获得第三方库,Cairo,链接/编译

显示的错误是未定义的符号,而不是我从示例中复制的Cairo函数,但我猜是内部函数。 我已经环顾四周并尝试使用$(pkg-config –cflags –libs cairo),逐字使用终端的常见在线示例。 我在使用EXPORT =(我的cairos .ps文件路径)后尝试过。 我目前在链接器设置中的CodeBlocks’链接库’中有一个选项: /usr/lib/x86-linux-gnu/libcairo.a 另外,我的编译器选项中有/usr/include/cairo 。 错误: /usr/lib/x86_64-linux-gnu/libcairo.a(cairo-image-source.o)||In function _cairo_image_source_finish’:| (.text+0x1c)||undefined reference to pixman_image_unref’| 还有50个更喜欢它。 哪个是从以下生成的,main.c: include cairo.h (with # and ) int main() { cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80); cairo_t *cr = cairo_create (surface); cairo_select_font_face (cr, “serif”, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size (cr, 32.0); cairo_set_source_rgb (cr, 0.0, 0.0, […]

crypt函数和链接错误“未定义引用’crypt’”

我在c中使用了crypt函数来加密给定的字符串。 我写了以下代码, #include #include int main() { printf(“%s\n”,crypt(“passwd”,1000)); } 但是上面的代码引发了一个错误,“未定义引用`crypt’”。 上面的代码有什么问题。 提前致谢。

简单的C内联链接器错误

简单的问题: 给出以下程序: #include inline void addEmUp(int a, int b, int * result) { if (result) { *result = a+b; } } int main(int argc, const char * argv[]) { int i; addEmUp(1, 2, &i); return 0; } 我收到链接器错误… Undefined symbols for architecture x86_64: _addEmUp”, referenced from: _main in main.o ld: symbol(s) not found for architecture […]

是什么导致错误“未定义引用(某些function)”?

我收到错误: main.o(.text+0x1ed): In function `main’: : undefined reference to `avergecolumns’ collect2: ld returned 1 exit status 当我gcc * .o。 我不太确定导致此错误的原因。 其他海报已经解释了它没有找到function或function是空的。 如果有人可以澄清或改进,那将非常感谢! 这是我的函数代码(我试图计算2D数组中列的平均值): #include “my.h” void averagecolumns (int x, int y, int** a) { int i; int j; float sum; float colAvg; sum = 0; colAvg = 0; printf(“i. The column averages are: \n”); for(i […]

内联函数“未定义符号”错误

我想写一个内联函数,但是我收到一个错误。 我该如何解决? 错误信息: Undefined symbols for architecture i386: “_XYInRect”, referenced from: -[BeginAnimation ccTouchesEnded:withEvent:] in BeginAnimation.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 码: CGPoint location = CGPointMake(60, 350); if (XYInRect(location, 53, 338, 263, 369)) { } inline BOOL XYInRect(CGPoint location, float […]

未定义的引用`strlwr’

我的代码就像一个文本压缩器,读取普通文本并变成数字,每个单词都有一个数字。 它在DevC ++中编译但不会结束,但是它不能在Ubuntu 13.10中编译。 我收到的错误就像Ubuntu中的标题“未定义引用`strlwr’”,我的代码有点长,所以我无法在这里发布,但其中一个错误来自: //operatinal funcitons here int main() { int i = 0, select; char filename[50], textword[40], find[20], insert[20], delete[20]; FILE *fp, *fp2, *fp3; printf(“Enter the file name: “); fflush(stdout); scanf(“%s”, filename); fp = fopen(filename, “r”); fp2 = fopen(“yazi.txt”, “w+”); while (fp == NULL) { printf(“Wrong file name, please enter file name again: […]

Cuda C – 链接器错误 – 未定义的引用

我很难编译一个只包含两个文件的简单cuda程序。 main.c看起来像这样: #include “my_cuda.h” int main(int argc, char** argv){ dummy_gpu(); } cuda.h看起来像这样: #ifndef MY_DUMMY #define MY_DUMMY void dummy_gpu(); #endif 并且my_cuda.cu文件像这样松散: #include #include “my_cuda.h” __global__ void dummy_gpu_kernel(){ //do something } void dummy_gpu(){ dummy_gpu_kernel<<>>(); } 但是,如果我编译我总是收到以下错误: gcc -I/usr/local/cuda/5.0.35/include/ -c main.c nvcc -c my_cuda.cu gcc -L/usr/local_rwth/sw/cuda/5.0.35/lib64 -lcuda -lcudart -o md.exe main.o my_cuda.o main.o: In function `main’: main.c:(.text+0x15): undefined […]