Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

link error

 
   Macintosh computer (Home) -> Programmer Code RSS
Next:  CW PRo 9.2 Speed  
Author Message
ISO-8859-1QRobert_

External


Since: Feb 20, 2004
Posts: 2



(Msg. 1) Posted: Mon Mar 15, 2004 10:48 pm
Post subject: link error
Archived from groups: comp>sys>mac>programmer>codewarrior (more info?)

Hi folks,
I usualy use the thumb's rule "link error undefined = missing source
file". However, I'm trying to add libjpeg files to my code and linker
says:
Link Error : undefined: 'jpeg_start_decompress' (code)
Referenced from 'JPEGDecompress(unsigned char*,int,unsigned char*)' in JPEG.cpp


jpeg_start_decompress is defined in jpeglib.h and source is in
jdapimin.c, which is a part of project. Does anyone have a clue?

thanks
Robert

 >> Stay informed about: link error 
Back to top
Login to vote
MW Ron

External


Since: Aug 04, 2003
Posts: 1662



(Msg. 2) Posted: Mon Mar 15, 2004 10:48 pm
Post subject: Re: link error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <2004031519484675249%robertcerny@maccom>,
Robert ?erný <robertcerny DeleteThis @mac.com> wrote:

 >Hi folks,
 >I usualy use the thumb's rule "link error undefined = missing source
 >file". However, I'm trying to add libjpeg files to my code and linker
 >says:
 >Link Error : undefined: 'jpeg_start_decompress' (code)
 >Referenced from 'JPEGDecompress(unsigned char*,int,unsigned char*)' in JPEG.cpp
 >
 >
 >jpeg_start_decompress is defined in jpeglib.h and source is in
 >jdapimin.c, which is a part of project. Does anyone have a clue?

first be sure the file is in the project, there is a dot in the target
column that shows if it is in or not in a target make sure that has a
dot for it.

Second is the old C - C++ name mangling problems. Be sure that you
aren't mixing C and C++ in the same project without using the correct
extern " C" on the headers.

Third is if this is C be sure the require function protoypes is on. It
could be looking for a function that has a different signature than what
you have.

Finally, remember that inline and static functions are not exportable
outside of the translation unit so even if it was in one file if it was
inlined you can't link to it from another source file. Inlines need to
be in headers.

Ron

--

Announcing CodeWarrior Development Tools for Windows v9.2
<a style='text-decoration: underline;' href="http://www.metrowerks.com/MW/Develop/Desktop/Windows/Professional/Default.htm" target="_blank">http://www.metrowerks.com/MW/Develop/Desktop/Windows/Professional/Default.htm</a>
Ron Liechty - MWRon DeleteThis @metrowerks.com - <http://www.metrowerks.com><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: link error 
Back to top
Login to vote
WINDOWS-1250QRober

External


Since: Mar 15, 2004
Posts: 5



(Msg. 3) Posted: Mon Mar 15, 2004 11:37 pm
Post subject: Re: link error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi,
indeed I'm mixing c and c++ code and the c headers doesn't contain the
right extern "C" wrapping. Unfortunatelly, I'm more Objective-C guy and
I don't recall the right syntax and rules. Could anyone point me to the
right direction?

Robert

PS: I believe that there should be in each header?

#ifdef  __cplusplus
extern "C" {
#endif


all includes here

#ifdef  __cplusplus
}
#endif



On 2004-03-15 20:13:27 +0100, MW Ron <mwron.DeleteThis@metrowerks.com> said:

 > In article <2004031519484675249%robertcerny@maccom>,
 > Robert ?erný <robertcerny.DeleteThis@mac.com> wrote:
 >
  >> Hi folks,
  >> I usualy use the thumb's rule "link error undefined = missing source
  >> file". However, I'm trying to add libjpeg files to my code and linker
  >> says:
  >> Link Error : undefined: 'jpeg_start_decompress' (code)
  >> Referenced from 'JPEGDecompress(unsigned char*,int,unsigned char*)' in JPEG.cpp
  >>
  >>
  >> jpeg_start_decompress is defined in jpeglib.h and source is in
  >> jdapimin.c, which is a part of project. Does anyone have a clue?
 >
 > first be sure the file is in the project, there is a dot in the target
 > column that shows if it is in or not in a target make sure that has a
 > dot for it.
 >
 > Second is the old C - C++ name mangling problems. Be sure that you
 > aren't mixing C and C++ in the same project without using the correct
 > extern " C" on the headers.
 >
 > Third is if this is C be sure the require function protoypes is on. It
 > could be looking for a function that has a different signature than
 > what you have.
 >
 > Finally, remember that inline and static functions are not exportable
 > outside of the translation unit so even if it was in one file if it
 > was inlined you can't link to it from another source file. Inlines
 > need to be in headers.
 >
 > Ron<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: link error 
Back to top
Login to vote
MW Ron

External


Since: Aug 04, 2003
Posts: 1662



(Msg. 4) Posted: Mon Mar 15, 2004 11:37 pm
Post subject: Re: link error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <2004031520375450073%robertcerny@maccom>,
Robert âern˜ <robertcerny.TakeThisOut@mac.com> wrote:

 >Hi,
 >indeed I'm mixing c and c++ code and the c headers doesn't contain the
 >right extern "C" wrapping. Unfortunatelly, I'm more Objective-C guy and
 >I don't recall the right syntax and rules. Could anyone point me to the
 >right direction?
 >
 >Robert
 >
 >PS: I believe that there should be in each header?
 >
 >#ifdef  __cplusplus
 > extern "C" {
 >#endif
 >
 >

All the header code is here


 >
 >#ifdef  __cplusplus
 >}
 >#endif

You can or can not put the #includes in the extern " C" group, Since
each should have this it isn't necessary.

Oh and you can do that in a prefix file or in your preprocessor dialog

Ron

--

Announcing CodeWarrior Development Tools for Windows v9.2
<a style='text-decoration: underline;' href="http://www.metrowerks.com/MW/Develop/Desktop/Windows/Professional/Default.htm" target="_blank">http://www.metrowerks.com/MW/Develop/Desktop/Windows/Professional/Default.htm</a>
Ron Liechty - MWRon.TakeThisOut@metrowerks.com - <http://www.metrowerks.com><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: link error 
Back to top
Login to vote
WINDOWS-1250QRober

External


Since: Mar 15, 2004
Posts: 5



(Msg. 5) Posted: Tue Mar 16, 2004 1:00 am
Post subject: Re: link error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Well,
I'm probably missing something obvious here. I included

#ifdef  __cplusplus
  extern "C" {
#endif


complete previous header contents here

#ifdef  __cplusplus } #endif


and it results in "undefined preprocessor directive"

What's wrong?

Robert<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: link error 
Back to top
Login to vote
Miro Jurisic

External


Since: May 10, 2004
Posts: 973



(Msg. 6) Posted: Tue Mar 16, 2004 1:00 am
Post subject: Re: link error [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <200403152200338930%robertcerny@maccom>,
Robert âern˜ <robertcerny.DeleteThis@mac.com> wrote:

 > #ifdef  __cplusplus } #endif

You mean

#ifdef  __cplusplus
}
#endif

Can't all go on one line.

meeroh

--
If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: link error 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
CW 6.0 OSX link error - Hello guys, I'm building a shared library under OSX with CW 6.0. I get the following link error: Link Error : undefined 'std::set_new_handler(void (*)(void))' (code)Referenced from 'Dll_MBNew' in main.cpp This is strange, since all other functions..

link error lib cw on pb - Hello We're trying to compile a lib done on CW ( apple linker ) on PB and we get a lot of link errors : ___cvt_fp2unsigned ___save_fpr_24 ___restore_fpr_24 ___save_fpr_28 ___restore_fpr_28 ___save_fpr_21 ___restore_fpr_21 ___save_fpr_27 ___restore_fpr_2...

CodeWarrior 8.3 Link Error - I'm using Win2k, with all the service pack and upto date. The "Access Denied" error is wrong, as I can write to that location (run as the admin on sys, and even created text files on that location) I got my CW8 updated to the latest 8.3 and i...

Link Error: Mac OS Packager - Hi all Codewarriors, After i move my project folder to other place, when i compile that powerplant project, the CodeWarrior compiler tell me there is a Link Error: "Link Error: Mac OS Packager: Couldn't set the package bit for the package fol...

Link error - What library do I need? - My code calls various IOKit calls. I have added IOKit to my frameworks, so my code compiles correctly, but when I try to run it I get these errors: Link Error : undefined: 'IOObjectRelease' (code) Link Error : undefined: 'IOIteratorNext' (code)..
   Macintosh computer (Home) -> Programmer Code All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]