cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/29/10:54:38

Message-Id: <199808291550.RAA24908@ieva06.lanet.lv>
From: "Andris Pavenis" <pavenis AT lanet DOT lv>
To: djgpp AT delorie DOT com, nonex AT hotmail DOT com
Date: Sat, 29 Aug 1998 17:54:25 +0300
MIME-Version: 1.0
Subject: Re: Undefined reference...
In-reply-to: <35e828da.3904793@news.piro.net>

From:           	nospam AT 127 DOT 0 DOT 0 DOT 1 (Xenon)
Subject:        	Undefined reference...
> 
> #include <stdio.h>
> #include <_String.h>
> 
> void main(void) {
>   String test(" Teststring ");
>   printf("|%s|\n",test);
> }

I think that the message from gcc is clear enough:

C:\D\OUTPUT>gcc -g3 -O3 xx.cc -lgpp -lstdcxx -o xx
xx.cc: In function `int main(...)':
xx.cc:6: warning: cannot pass objects of type `String' through `...'

That means that You should add explicit cast to 'const char *' as
object of class String cannot be used as parameter to printf:

   printf("|%s|",(const char *) test);

After that the example works (One hint: if you get unresolved 
references without optimizations try -O)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019