Question:
c++ help 'undefined reference to 'line?
2014-06-07 02:48:09 UTC
im trying to help my friend out since my knowledge of c++ in scale from 0-10 is about 0.5 and his 0.1....
I've got this code here for x.y line graph and i get this error message 'undefined reference to 'line'

anyone know how to solve this?

#include
#include
#include
#include
using namespace std;
int main()
{ int x1=0, x2=50;
int a, b;
std::cout << "Enter a: ";
std::cin >> a;
std::cout << "Enter b: ";
std::cin >> b;
int y1=a*x1+b, y2=a*x2+b;
line (x1, y1, x2, y2);
}
Four answers:
2014-06-07 07:55:19 UTC
@james ok...i believve i've got everyting up but now i get the error Compiling: C:\Users\Kierownik\Desktop\wha3.cpp

Linking console executable: C:\Users\Kierownik\Desktop\wha3.exe

mingw32-g++.exe: no input files

Process terminated with status 1 (0 minutes, 0 seconds)

0 errors, 0 warnings



i've been told that i have to input files but....what files?:D
2014-06-07 03:19:05 UTC
you're including winbgim.h



that means you're using WinBGIm



WinBGIm is a Windows C++ graphics library based on the classic Borland Graphics Interface (originally distributed with Borland's Turbo Pascal and later with their Turbo C compilers).

http://www.cs.colorado.edu/~main/bgi/install.html



I have no idea how old it is or if its up to date

you might not be able to get it working at all



but here's some info

http://winbgim.codecutter.org/



I don't know what you'll have to do to get it to work, but look through all these links.



here's some info on getting it to work with Dev C++ (which is a really, really old compiler and nobody uses it because its so out of date, but maybe it will help you get it setup for whatever compiler you are using)

http://www.cs.colorado.edu/~main/bgi/dev-c++/



here's some stuff on someone trying to get it to work with codeblocks

http://forums.codeblocks.org/index.php?topic=18822.0



http://www.cplusplus.com/forum/beginner/7409/



and here's another Dev C++ project

/watch?v=E13lgVGWcxg

https://www.youtube.com/watch?v=E13lgVGWcxg



there's a link to the source code in the "about" of that video
Alex
2014-06-07 02:56:08 UTC
The problem is that you just use line when you haven't declared it. I suppose line is supposed to be an array so, since it's an array of integers, something like that should work:



int line(4) = {x1, y2, x2, y2}



Put that just before you used line and it should work. Note, that I don't have much knowledge of C++ but this is pretty basic so it should work.



Another thing I want to point out is that you don't need to add "std::" before every cout and cin expression. That's what "using namespace std;" is for. Just use "cout << "Message";".



I hope this helps. Happy coding.
VenuG
2014-06-07 02:56:51 UTC
I guess that one necessary headder file is not included. Try adding the line #include If this does not solve the problem add the line #include

Further for displaying graphics you may need to edit some configuration file. Please read this :

http://stackoverflow.com/questions/3069182/how-can-i-see-the-c-c-include-graph-easily


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...