Results 1 to 8 of 8

Thread: compiling a *.C file with gcc -> error

Threaded View

  1. #1
    Join Date
    Jun 2005
    Location
    South Africa
    Beans
    259
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Question compiling a *.C file with gcc -> error

    Hi there,

    I am trying to compile a simple C++ program with gcc and i get the error:

    Look at output.txt file below... could not paste output... too many faces what so ever...


    I compiled it on another machine with gcc and it works well...

    i have the build-essential package installed aswell...?

    it probably is a simple mistake... here is the program... i am starting to learn to program in C++

    Code:
    // increaser.. using Void!
    
    #include <iostream>
    using namespace std;
    
    void increase (void* data, int size)
    {
    	switch (size)
    	{
    		case sizeof(char) : (*((char*)data))++; break;
    		case sizeof(int) : (*((int*)data))++; break;
    	}
    }
    
    int main ()
    {
    	char a = 'x';
    	int b = 1602;
    	increase (&a,sizeof(a));
    	increase (&b,sizeof(b));
    	cout << a << ", " << b << endl;
    	return 0;
    Attached Files Attached Files

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •