0

I am trying to use jwsmtp library with dev c++ but I get linker errors. Anybody know how to use it with dev c++?, actually I have to send an email with attachment from my c program so I am trying to use it, but if anyone have alternative it will also be appreciated.

   [Linker error] main.o:main.cpp:(.text+0x12c): undefined reference to `jwsmtp::mailer::send()'
acraig5075
  • 10,588
  • 3
  • 31
  • 50
Dark Corp
  • 47
  • 8
  • Check out all the alternatives mentioned [C SMTP Example](http://stackoverflow.com/questions/58210/c-smtp-example) and [Send Email with C](http://stackoverflow.com/questions/7298762/send-email-with-c) for starters. – acraig5075 Dec 14 '12 at 10:15
  • ya i searched on google too much but no success in finding code with email attachments – Dark Corp Dec 14 '12 at 10:16
  • Did you try searching for `undefined reference`? Also consider switching to VC++ Express. – Bartek Banachewicz Dec 14 '12 at 10:42
  • i have not use visual c++ i think its complex dev c easy to use more powerful ID – Dark Corp Dec 14 '12 at 11:20

1 Answers1

1

From the error message you are getting, it seems like the library is not properly linked with your program. So please make sure that JWSMTP is included in your final executable. Properly link the library and you will be good to go. Go to the compiler option of Dev C++ and add your library path there if it isn't done already [In my version of Dev C++ Ide it is located at Menu -> Tools -> Compiler options -> Directories Tab -> Libraries] [Btw I dont have the reputation to comment.:( So I'm posting this as an answer. I'll delete this if this is not solving your problem]

NeonGlow
  • 1,659
  • 4
  • 18
  • 36
  • i added the jwsmtp.lib and linked to project but still it give linker error i think dev c++ have .a .o types libs the lib i found for jwsmtp is .lib extension so anybody know how to convert it to .a or .o form – Dark Corp Dec 14 '12 at 10:51
  • If you can compile the jwsmtp source code using gcc [use gcc -c] or other similar compilers you will get the .o [object] files. Try putting those files in Dev C++ lib path. – NeonGlow Dec 14 '12 at 10:57
  • k downlaoding cygwin and hope i get object files – Dark Corp Dec 14 '12 at 11:32
  • @DarkCorp: Best of luck... Meantime you may find this useful.http://stackoverflow.com/questions/2337949/whats-the-difference-between-lib-and-a-files – NeonGlow Dec 14 '12 at 12:09
  • i created objects files of jwsmtp source code mailer.cpp , base64.cpp compat.cpp (mailer.o , base64.o , compat.o) then i add their paths in project options > parameters>linker .......... now getting again linker errors but a lot ... also i tried this i add this to linker g++-jwsmtp but it give error that g++-jwsmtp: No such file or directory. – Dark Corp Dec 14 '12 at 13:23
  • In the library folder `jwsmtp-1.32.15\docs` [assuming you are using the latest version] there is a file usage.html which describes about using the library in our programs [check other files in that folder too]. Pls check those. – NeonGlow Dec 15 '12 at 04:24
  • well am improved i compile code with cgywin and g++ compiler i get .a libs also i compiled the demo programs too but in dev c its not working i imported .a libs too – Dark Corp Dec 15 '12 at 08:50
  • @DarkCorp : Glad that you are progressing well :) – NeonGlow Dec 17 '12 at 04:02
  • finally i linked jwsmtp with dev c++ :D now problem is it cant send mail i set smtp server to smtp.gmaile.com and port to 465 but no sending mails – Dark Corp Dec 23 '12 at 06:34
  • i think this library cant support ssl – Dark Corp Dec 23 '12 at 06:40