Reference Kdevelop中未定义的引用
我有main.cpp,从io.c链接测试函数Reference Kdevelop中未定义的引用,reference,ubuntu-12.04,undefined-reference,kdevelop,printf-debugging,Reference,Ubuntu 12.04,Undefined Reference,Kdevelop,Printf Debugging,我有main.cpp,从io.c链接测试函数 #include <iostream> #include "io.h" int main(int argc, char **argv) { test(); return 0; } 然而,当我构建一个项目时,出现了未定义引用的错误。 请帮帮我 PS:If main.cpp引用了两个库,如l1.h和l2.h。如何将这些链接到main.cpp?您应该提供错误信息。尽管如此,您似乎缺少一些库的链接 还要注意,这是一个CMake
#include <iostream>
#include "io.h"
int main(int argc, char **argv) {
test();
return 0;
}
然而,当我构建一个项目时,出现了未定义引用的错误。
请帮帮我
PS:If main.cpp引用了两个库,如l1.h和l2.h。如何将这些链接到main.cpp?您应该提供错误信息。尽管如此,您似乎缺少一些库的链接
还要注意,这是一个CMake问题,而不是KDevelop问题。如果您研究cmake,您可能会找到更多文献。如果不公布实际错误,我们将无法帮助您。另外:您可能不想添加io.h头文件!到来源列表。
#include <stdio.h>
#include "io.h"
void test() {
printf("hee");
}
project(test)
set(MyProjectSources io.c io.h main.cpp )
add_executable(test ${MyProjectSources})