Skip to main content
anhhuy0701
Associate III
March 3, 2014
Question

symbol __stdout multiply define, symbol __stdin multiply define

  • March 3, 2014
  • 10 replies
  • 2347 views
Posted on March 03, 2014 at 17:13

hello everyone, today I see a problem but no way to solve it

I really want your help

here is my source code

&sharppragma import(__use_no_semihosting_swi)

struct __FILE { int handle;};

FILE __stdout;

FILE __stdin;

----> errors : symbol __stdout multiply define, symbol __stdin multiply define

if I insert the ''extern'' keyword:

extern FILE __stdout;

extern FILE __stdin;

the error will be : Library reports error: __use_no_semihosting_swi was requested, but _sys_open was referenced

thank and regards!

#semihosting #keil
This topic has been closed for replies.

10 replies

chen
Associate II
March 3, 2014
Posted on March 03, 2014 at 17:59

Hi

''today I see a problem but no way to solve it

I really want your help''

''here is my source code

#pragma import(__use_no_semihosting_swi)

struct __FILE { int handle;};

FILE __stdout;

FILE __stdin;

----> errors : symbol __stdout multiply define, symbol __stdin multiply define''

There is no way for use to help you unless you tell use more :

which compiler/linker

which libraries you are using

which debugger/IDE

your source code that is generating these errors

anhhuy0701
Associate III
March 4, 2014
Posted on March 04, 2014 at 01:37

dear sung.chen_chung

the tool is Keil uvision4 with ST-Link debugger

chen
Associate II
March 4, 2014
Posted on March 04, 2014 at 10:16

Hi

OK. Do you understand what :

''#pragma import(__use_no_semihosting_swi)''

is trying to do?

Do you understand what

''FILE __stdout;''

is trying to do?

anhhuy0701
Associate III
March 4, 2014
Posted on March 04, 2014 at 16:46

I don't know, can you explain for me

Tesla DeLorean
Guru
March 4, 2014
Posted on March 04, 2014 at 16:47

Do you have ''Use MicroLIB'' checked?

Otherwise you're going to have to figure where else these definitions are being pulled from. I've got this code in a bunch of my apps and it links just fine. Review the project settings and files more critically.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
chen
Associate II
March 4, 2014
Posted on March 04, 2014 at 17:08

Hi

''#pragma import(__use_no_semihosting_swi)''

Is telling the compiler/linker that you as the developer are going to take responsibility for 'semi hosting functionality' - in other words take responsibility for standard IO - the console and error console, serial IO, Disk IO etc

This affects things like printf, putc, getc etc

See

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0067d/Ciheeaja.html

''FILE __stdout;''

Is trying to define where the standard output (console, line out etc) is going.

As Clive mentioned, tick the ''Use MicroLIB''

If this does not capture and provide stdout, stdin etc - you cannot use things like printf().

This is embedded development where sometimes there is no provision for stdout and stdin

anhhuy0701
Associate III
March 4, 2014
Posted on March 04, 2014 at 17:09

thank ad! I have to solved it

Andrew Neil
Super User
March 4, 2014
Posted on March 04, 2014 at 21:47

What is semihosting?

see: 

http://www.keil.com/support/man/docs/armccref/armccref_Bgbjjgij.htm

And, for using things like printf without  Semihosting, see: 

http://www.keil.com/support/man/docs/ARMLIB/armlib_cjagdcbh.htm

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
hungconbvh
Visitor II
July 4, 2015
Posted on July 04, 2015 at 06:58

I have a question, sr.

Tesla DeLorean
Guru
July 4, 2015
Posted on July 04, 2015 at 16:43

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6Vq&d=%2Fa%2F0X0000000bpa%2FcFvklqxmsJ206u84kVXdS5dO9ed5lYtJWA.SkQtvF30&asPdf=false
Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..