From mint-bounce@lists.fishpool.fi Sat May 29 00:48:23 2010 Message-ID: <4C009C17.60403@freesbee.fr> Date: Sat, 29 May 2010 06:46:15 +0200 From: =?ISO-8859-1?Q?Vincent_Rivi=E8re?= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: mint@lists.fishpool.fi Subject: Re: [MiNT] This must be an gcc / ld error! References: <6f058cd2548d6d5f3dd6be1d3e1793ba-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYAWEF3AVU6XF1YRUwLXlxYSQ==-webmailer2@server07.webmailer.hosteurope.de> <4BFED67C.1090409@freesbee.fr> <7a3bf57c90aa9a65f4abfd0b002d6fd9-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYAWEF3AVU6XF1YRUwLWFpZRA==-webmailer2@server07.webmailer.hosteurope.de> <4BFF8B10.1080709@freesbee.fr> <8b995d6108853d4ff50d6ce5f4704df1-EhVcX1lFRQVaRwYcDTpQCEFddQZLVF5dQUBFBDBTXF5bVkYJXlloAFNVMl5dRkACWV9RQ18=-webmailer2@server04.webmailer.hosteurope.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: vincent.riviere@freesbee.fr Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.sparemint.org id o4T4mNHa009309 Ole Loots wrote: > How to compile this code: > > #include > > int main ( void ) > { > char * x = "1235554444111abc"; > char * y; > y = strchrnul(x, (int)'a'); > return( 0 ); > } > > without missing references? What do you call a "missing reference" ? A linker unresolved external ? I use the CVS MiNTLib shipped with my cross-compiler and I don't get any unresolved external. However, by default strchrnul() is not declared in string.h. I causes a warning, not an error : $ m68k-atari-mint-gcc -Wall tst.c -o tst.tos tst.c: In function 'main': tst.c:7:2: warning: implicit declaration of function 'strchrnul' tst.c:7:4: warning: assignment makes pointer from integer without a cast Using a function without a prototype is allowed by the C language but should be avoided, because arguments may be passed incorrectly. There are a lot of nonstandard functions supported by the MiNTLib but not declared by default. You can turn all these features on by defining _GNU_SOURCE. $ m68k-atari-mint-gcc -Wall -D_GNU_SOURCE tst.c -o tst.tos No more warnings, everything fine. -- Vincent Rivière