SYNOPSIS
#include <vga.h>
int vga_getxdim(void);
int vga_getydim(void);
int vga_getcolors(void);
How would you actually use this? Like, if you wanted to use that
function vga_getxdim()? I know nothing about C, but I'm just curious.
I tried creating this:
---vga.c----------------
#include <iostream>
#include <vga.h>
int main()
{
int x=0;
int x = vga_getxdim(void);
std::cout << x + "\n";
return 0;
}
And then tried compiling with `g++
-I/usr/src/linux-2.4.18-14/drivers/video vga.c -o vga' but got a ton
of errors.
Can anyone post their source and compile command for a curious person?
cat > vgs.c << EOF
#include <stdio.h>
#include <vga.h>
int main()
{
int x;
x = vga_getxdim();
fprintf(stderr, "x = %d\n", x);
return 0;
}
EOF
gcc -lvga vgs.c -o vgs
> I tried creating this:
>
> ---vga.c----------------
>
> #include <iostream>
> #include <vga.h>
>
> int main()
> {
> int x=0;
> int x = vga_getxdim(void);
> std::cout << x + "\n";
> return 0;
> }
>
>
> And then tried compiling with `g++
1) You're declaring your variable "x" twice. Once is enough.
2) vga_getxdim(void) is the function declaration in which the (void) tells
us that it takes no parameters. In actual use, you therefore put nothing
between the parentheses: int x = vga_getxdim();
3) std::cout is a C++ construct but your source file is vga.c, and the
compiler will therefore expect C syntax, not C++. Rename it to vga.cpp and
recompile.
Alternatively, just do it in C:
#include <stdio.h>
#include <vga.h>
int main() {
printf("%d\n",vga_getxdim());
return 0;
}
--
G. Stewart -- gstewart at gstewart dot homeunix dot net
gstewart at spamcop dot net
Registered Linux user #284683
GnuPG key : BA3D01C6 (pgp.mit.edu)
Fingerprint: C3DF C686 6572 6E59 E3E4 0F40 2B9A 2218 BA3D 01C6
---------------------------------------------------------------
In the 60's people took acid to make the world weird.
Now the world is weird and people take Prozac to make
it normal.
:)
Godwin Stewart <gstewar...@remove.spamcop.net> wrote in message news:<3e424c8c$0$99306$45be...@newscene.com>...