Hi,
I have two problems with compiling my program.
One is that I cannot get correct output with Genode::printf or sprintf for
(unsigend) long long values.
Below is my code:
#include <base/printf.h>
#include <stdio.h>
#include <sys/types.h>
int main()
{
char test_buf[24];
uint64_t llu_var = 1234567801234ULL;
sprintf(test_buf, "%llu", llu_var);
Genode::printf("result of test_buf:%s\n", test_buf);
Genode::printf("llu_var:%llu\n", llu_var);
return 0;
}
I compiled this with "LIBS += env cxx libc" in target.mk and built it for
foc_pbxa9 on QEMU.
The result is strange:
[init->mytest] result of test_buf:2153943278813471
[init->mytest] llu_var:8212781840017129473
Another one is that I get compilation errors as below:
source codes:
#include <base/printf.h>
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <sstream>
using namespace std;
template <class T>
inline string to_string(const T& t)
{
stringstream ss;
ss << t;
return ss.str();
}
int main()
{
int64_t value = 1023456LL;
Genode::printf("sstream value:%lld, to_string:%s\n", value,
to_string(value).c_str());
return 0;
}
in target.mk
LIBS += stdcxx env cxx libc
CC_OPT += -D_GLIBCXX_HAVE_MBSTATE_T
error message:
/usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
In function '__cxa_begin_catch':
(.text.__cxa_begin_catch+0xc0): undefined reference to '__Unwind_Complete'
/usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
In function '__cxa_end_catch':
(.text.__cxa_end_catch+0x30): undefined reference to '__Unwind_DeleteException'
/usr/local/genode-gcc/bin/../lib/gcc/arm-elf-eabi/4.6.1/../../../../arm-elf-eabi/lib/libstdc++.a(eh_catch.o):
In function '__cxa_end_catch':
(.text.__cxa_end_catch+0xdc): undefined reference to '__Unwind_DeleteException'
collect2: ld returned 1 exit status
make[2]: *** [mytest] Error 1
Does any one know how to fix these?
Thanks.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main