0

我正在使用 Eclipse Juno CDT。

我在我的项目中添加了以下内容:

  • 包含路径设置的 mysql/includes 路径
  • libmysql.lib 和 zlib.lib 到库设置
  • mysql 库路径到库路径设置

现在,当我制作项目时,运行应用程序时编译会引发错误。这是构建:

10:08:56 **** Build of configuration Debug for project mysqlapp ****
make all 
Building file: ../src/mysqlapp.c
Invoking: Cygwin C Compiler
gcc -I"C:\Program Files\MySQL\MySQL Connector C 6.0.2\include" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/mysqlapp.d" -MT"src/mysqlapp.d" -o "src/mysqlapp.o" "../src/mysqlapp.c"
cygwin warning: 
MS-DOS style path detected: C:\Users\Yonaton\workspace\mysqlapp\Debug
Preferred POSIX equivalent is: /cygdrive/c/Users/Yonaton/workspace/mysqlapp/Debug
 CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building: ../src/mysqlapp.c

Building target: mysqlapp.exe
Invoking: Cygwin C Linker
gcc -L"C:\Program Files\MySQL\MySQL Connector C 6.0.2\lib\opt" -o "mysqlapp.exe"  ./src/mysqlapp.o   
Finished building target: mysqlapp.exe

这是 Eclipse 中的运行:

10:09:55 **** Incremental Build of configuration Debug for project mysqlapp ****
make all 
src/mysqlapp.d:1: *** multiple target patterns.  Stop.

10:09:56 Build Finished (took 225ms)
4

2 回答 2

0

如果我没记错的话,在您的库之前使用“-l”(小 L)。

于 2012-11-22T14:39:05.513 回答
0

Project->Properties->C/C++ General->Paths and Symbols->Libraries不要添加库的文件名,也不要添加路径。

因此,如果您想链接,/lib64/libz.so只需添加z.

或交替添加zunder Project->Properties->C/C++ Build->Settings->GCC Linker->Libraries

如果库不在标准路径下,请在Project->Properties->C/C++ General->Paths and Symbols->Libraries Paths.


更新(指“多个目标模式”)

make不喜欢 DOS 路径。在.d文件:中,驱动器号后面的 a 被解释为目标分隔符。

切换到 UNIX 路径(正如您已经被告知要做的那样...... ;-))。

(另请参见:“多个目标模式”Makefile 错误

于 2012-11-22T14:53:04.180 回答