添加C mysql库Eclipse CDT后,Makefile出错

时间:2012-11-22 14:32:55

标签: mysql c eclipse makefile eclipse-cdt

我正在使用Eclipse Juno CDT。

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

  • mysql /包含包含路径设置的路径
  • 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

这是日食中的运行:

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)

2 个答案:

答案 0 :(得分:0)

如果我在你的图书馆之前记得正确的“-l”(小L)。

答案 1 :(得分:0)

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

因此,如果您想与/lib64/libz.so进行关联,只需添加z

或者可选地在z下添加Project->Properties->C/C++ Build->Settings->GCC Linker->Libraries

如果库未位于标准路径下,请在Project->Properties->C/C++ General->Paths and Symbols->Libraries Paths下添加库的自定义搜索路径。


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

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

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

(另见:"multiple target patterns" Makefile error