Author Topic: Using strings with c++  (Read 4768 times)

0 Members and 1 Guest are viewing this topic.

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Using strings with c++
« on: February 03, 2015, 06:52:22 pm »
Hey guys,
sorry to ask you again for something, but this time its that i dont know how to use strings.

Normally strings work like this:

Code: [Select]
#include <string>

using namespace std;

int main()
{
    string foo = "bar";
}

But this doesnt work, because i cant include the string library ...
Is there anything i forgot to download?
Do i really have to use c-strings?

Or am i just too dumb for this?

ps.: Am i posting in the right forum? I havent found a subforum for such questions ...

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: Using strings with c++
« Reply #1 on: February 03, 2015, 09:51:02 pm »
What's the error? It works fine for me. Do you have the latest SDK?

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: Using strings with c++
« Reply #2 on: February 04, 2015, 01:45:50 pm »
http://gyazo.com/5e8423c75e1d2f1d54392933bb9dc774
http://gyazo.com/b156d289190cd5ce1658f1a78d07e4f9

Thats the error. Seems like it cant find something like string_basic.tcc

Can i manually download this anywhere?
Can you attach it if you find it in your directory?
« Last Edit: February 04, 2015, 02:42:35 pm by Virusscript24 »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Using strings with c++
« Reply #3 on: February 04, 2015, 02:44:00 pm »
Are you running linux? If so, do you have linux-headers installed?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: Using strings with c++
« Reply #4 on: February 04, 2015, 03:14:30 pm »
Nope im using windows ...
But i have Linux dualboot if that helps me

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Using strings with c++
« Reply #5 on: February 04, 2015, 03:19:17 pm »
googling for bits/basic_string.tcc
First result:
https://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a00771_source.html

Seems like you need to install libstdc++

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: Using strings with c++
« Reply #6 on: February 04, 2015, 03:34:02 pm »
libstdc++ is already installed, but gcc 4.6.3 is just way to old. AFAIK the toolchain you're using is outdated, there should be a more recent one somewhere, although I strongly advise to use linux (ndless-sdk from docker or self-compiled) or cygwin. Both ways are tested and work just fine, with the latest GCC 4.9.2.

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: Using strings with c++
« Reply #7 on: February 04, 2015, 03:41:16 pm »
Thanks!

Sorry if that seems like i was too lazy to google, but i thought this problem is directly related to the ndless sdk

Fixed it now, if anyone else has the same problem, here it is.
I saved it here

Code: [Select]
NdlessSDK\yagarto\arm-none-eabi\include\c++\4.6.2\arm-none-eabi\bits
and it worked.

EDIT:
hmm ye i'll update it soon, i just thought i already have the newest version.