Error C3861:Identifier not found

Hi,
I am using atof function in my Form.h file of VC++ project.
I have added a #include "math.h" in my .cpp file.but when I am building the project I am getting error "Error C3861:atof:Identifier not found.

Why this is happening ,whether I am missing something.
Did you include the libraryheader that holds the atof() function? I think it's <stdlib.h>.

[edit] Unnoobed.
Last edited on
Did you include the library that holds the atof() function? I think it's <stdlib.h>.


ouch. I mean, not wrong, but you include headers, not libraries.

Answer: What gaminic said. Except that you should include <cstdlib> instead if you're using C++ instead of C.
How can I include these libraries.i am using VS2008.
You need to include the header <cstdlib>, just like you included math.h (which should be between <>, I think? Unless you made your own math.h header).
Hi Gaminic,
I added #include "cstdlib" in .cpp file but still getting the same error.
Any other thoughts.
You should write #include <cstdlib> instead of #include "cstdlib" .


Just show us the relevant code, it's a bit hard to tell what you're actually doing without seeing it.
// Demo_C++.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"
#include "cstdlib"

using namespace Demo_C;

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}


#pragma once


namespace Demo_C {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:

private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(28, 105);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(282, 255);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);

}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)
{
System::String^ string="0";
double d=atof(string);
}
};
}

Topic archived. No new replies allowed.