把Cpp的后綴該為C是什么樣的
嘗試引用一個奇門排盤的c程序,在git上找到的叫cqm,
然后總是報錯?error: undefined reference to `f()'
很是郁悶
于是新建了個項目試驗一下,終于摸清了需要命名空間。
后來這么寫就可以了
a.h?
namespace XX
{
int f();
}
a.cpp (c文件不支持命名空間!)文章來源:http://www.zghlxwxcb.cn/news/detail-730678.html
#include "a.h"
namespace XX{
int f(){
return 0;
}
}
test.cpp 引用的cpp文章來源地址http://www.zghlxwxcb.cn/news/detail-730678.html
#include "test.h"
#include "a.h"
Test::Test()
{
XX::f();
}
到了這里,關(guān)于Qt 編譯純c的C99的項目, error: undefined reference to `f()‘的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!