0

Hey.
Im working on a new Project but i need your help converting a std::string to double!

I dont know why i get the LNK error so i hope someone of you know it :).

Here are the includes...

#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <string>

ok i think that only stdlib.h and stdio.h is necessary for that function but ok here is the function.

double toDouble(string in){

double out = atof(in.data());

return out;
}

it should work right? but it doesnt :(.

Here is the error... in german :x

Fehler 1 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl calcstring(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?calcstring@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@Z)" in Funktion ""void __cdecl calc3(void)" (?calc3@@YAXXZ)". TaschenRechner.obj

I think i have to include a lib with #pragma comment(lib, "xXx");
but i dont know which :o... MSDN wont help me :'(.

Thanks!
Daniel

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Ultratermi
0

Thanks, but it doesent work too :(

Edited by Ultratermi: n/a

0

> Here is the error... in german :x
Except that seems to suggest the problem is in a function called calc3() and not one called toDouble().

Did you fix it in all the places?

Posting new error messages would be better than "it didn't work".

0

Oh no im such a fool... No error is in this function but in another one :o. Sorry guys :x

Thanks Salem :) Fixed it now ;)...

Edited by Ultratermi: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.