cancel
Showing results for 
Search instead for 
Did you mean: 

symbol __stdout multiply define, symbol __stdin multiply define

anhhuy0701
Associate II
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
10 REPLIES 10
chen
Associate II
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 II
Posted on March 04, 2014 at 01:37

dear sung.chen_chung

the tool is Keil uvision4 with ST-Link debugger

chen
Associate II
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 II
Posted on March 04, 2014 at 16:46

I don't know, can you explain for me

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
chen
Associate II
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 II
Posted on March 04, 2014 at 17:09

thank ad! I have to solved it

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

hungconbvh
Associate
Posted on July 04, 2015 at 06:58

I have a question, sr.