January 6th, 2013, 05:31 PM
linking error? I just started learning C++...
So I just downloaded DEVc++, just using an example my teacher has given during class to check if it works. Now that it didn't work and I don't know why. I tried to looking for answers about linking error online, but I can't understand the answers.
So here is the program:
//Program to convert from Fahrenheit to Celcius
double fahrenToCelsius (double t);
//t is a valid tempreture in Fahrenheit
//returns equivalent temp. in Celcius
int main ()
using namespace std;
cout<< "Enter temp. in degrees Fahrenheit. ";
cin >> f;
cout<< f << "in degs. Fahrenheit = "
<< fahrenToCelsius (f) << "in degs. Celcius" ;
double fahrenToCelcius (double t)
And here is the problem:
[Linker error] C:\Users\Owner\AppData\Local\Temp\cckex8SZ.o:fahrenToCelsius.cpp: (.text+0x3d): undefined reference to `fahrenToCelsius(double)'
collect2: ld returned 1 exit status
I'm suspecting the program maybe that I saved it wrong? I saved it as fahrentoCelsius.cpp inside the folder "Work" ( I created this folder) which is inside the folder "Dev-cpp".
January 6th, 2013, 05:52 PM
Re: linking error? I just started learning C++...
Sorry, can someone help me delete this post? I just found out my problem was so simple. Nothing about saving. I just have to put the line using namespace std; right underneath #include<iostream>
Well, I solved my own problem, sorry about the trouble again!
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!