当前位置: 技术问答>linux和unix
mysql++问题
来源: 互联网 发布时间:2015-12-16
本文导语: //test.cpp #include int main() { Connection conn; } g++ test.cpp -I /opt/mysql/include -I /opt/mysql++/include/mysql++ test.cpp: In function `int main()': test.cpp:4: `Connection' undeclared (first use this function) test.cpp:4: (Each undeclare...
//test.cpp
#include
int main() {
Connection conn;
}
g++ test.cpp -I /opt/mysql/include -I /opt/mysql++/include/mysql++
test.cpp: In function `int main()':
test.cpp:4: `Connection' undeclared (first use this function)
test.cpp:4: (Each undeclared identifier is reported only once for each function
it appears in.)
test.cpp:4: syntax error before `;' token
头文件connection.h里明明定义了Connection,为什么会出这个错误啊?
#include
int main() {
Connection conn;
}
g++ test.cpp -I /opt/mysql/include -I /opt/mysql++/include/mysql++
test.cpp: In function `int main()':
test.cpp:4: `Connection' undeclared (first use this function)
test.cpp:4: (Each undeclared identifier is reported only once for each function
it appears in.)
test.cpp:4: syntax error before `;' token
头文件connection.h里明明定义了Connection,为什么会出这个错误啊?
|
加上
#include
using namespace std;
#include
using namespace std;
|
用
g++ test.cpp -I- -I /opt/mysql/include -I /opt/mysql++/include/mysql++
编译,
最好用#include
g++ test.cpp -I- -I /opt/mysql/include -I /opt/mysql++/include/mysql++
编译,
最好用#include
|
晕,
-I /opt/mysql/include
-I后面不能有空格
-I /opt/mysql/include
-I后面不能有空格