0

I'm using Eclipse Juno CDT.

I added the following to my project:

  • the mysql/includes path to the includes path setting
  • the libmysql.lib and zlib.lib to libraries setting
  • the mysql library path to the library paths setting

Now, when I make my project, the compilation throws an error when I run the application. This is the build:

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

And this is the run within 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)
somejkuser
  • 8,856
  • 20
  • 64
  • 130

2 Answers2

0

If I remember correctly "-l" ( small L) before your libraries.

Ashish Yadav
  • 253
  • 1
  • 3
  • 7
0

Under Project->Properties->C/C++ General->Paths and Symbols->Libraries do not add the file name of the library, nor the path.

So if you want to link against /lib64/libz.so just add z.

Or alternativly add the z under Project->Properties->C/C++ Build->Settings->GCC Linker->Libraries.

If the library is not located under a standard path add the custom search path for a library under Project->Properties->C/C++ General->Paths and Symbols->Libraries Paths.


Update (referring "multiple target patterns"):

make does not like DOS paths. In the .d file a : after the drive letter is interpreted as target delimiter.

Switch to UNIX paths (as you were already told to do ... ;-)).

(see also: "multiple target patterns" Makefile error)

Community
  • 1
  • 1
alk
  • 69,737
  • 10
  • 105
  • 255
  • Im adding the libraries within eclipse. Im not buildiing the makefile myself – somejkuser Nov 22 '12 at 14:54
  • Im referring to Eclipse Juno. Please see my updated answer. @jkushner – alk Nov 22 '12 at 14:56
  • K That seemed to fix it. Now I have another problem... when I run the app, it works fine.. however, in eclipse, it prompts a new error - in mysqlapp.d, it says "multiple target patterns". It seems to be including mysql library files twice. – somejkuser Nov 22 '12 at 15:03
  • 1
    @jkushner: Add the contents of `mysqlapp.d`, perhaps? – DevSolar Nov 22 '12 at 15:16
  • How do I switch to unix style in eclipse? should i be running eclipse from cygwin perhaps? Isnt elipse is supposed to handle all this, or is it a problem based from cygwin? – somejkuser Nov 22 '12 at 15:37
  • Everywhere in Eclpse where you entered paths change them to be UNIX paths. For example you entered `C:\Program\ Files\MySQL\MySQL\ Connector\ C\ 6.0.2\include` some where. Change it to be `/cygdrive/c/Program\ Files/MySQL/MySQL\ Connector\ C\ 6.0.2/include`. Another advice: Do not use special characters in paths/file names. The latter you should have been told also already when installing Cygwin. @jkushner – alk Nov 22 '12 at 15:40
  • It a problem with this `:` notation, to not say it's a windows problem. @jkushner – alk Nov 22 '12 at 15:43
  • If I just put the libs within a lib directory within the project, that should solve this problem correct? I dont really need to have the mysql includes folder on the includes path if i can just get the libs? – somejkuser Nov 22 '12 at 16:04
  • Place the include files where you like. As long as the pre-processor and the compiler know where they are (told by the `-I` option, set via `Project->Properties->C/C++ General->Paths and Symbols->Includes->GCC` it's ok. @jkushner – alk Nov 22 '12 at 16:10
  • This is the correct answer, but Im still having issues because windows eclipse wont allow me to change it to a relative path setting or a unix style setting. – somejkuser Nov 22 '12 at 16:27