PDA

View Full Version : total mess with gcc and g++



thedardanius
October 29th, 2012, 04:23 PM
ok, so Im a windows C++ programmer.
Now i create a linux program and I downloaded codeblocks and gcc compiler(which was already installed). THe problem now is:
I tried to compile the code generated by the compiler itself (demo code for opengl apps) but it said that it missed header. So i looked in the standard directory (usr/local/include/) and i didnt found ANYTHING! what do you call that. IŽnever heard of a compiler coming without standard headers/libraries. So now im totally confused.

I;m new to linux and the programming, the working the makefiles...is there any tutorial on basic gcc/g++ and which sdk should I download? Ive already downloded xlib11 dev, but where is stdio? PLEASE help me out of this turmoil.

thedardanius
October 29th, 2012, 04:25 PM
where are the standard opengl headers/libs???
what is a .so? Im not familiar with linux terms../

Majorix
October 29th, 2012, 04:26 PM
This should install what you need:

sudo apt-get install build-essential

EDIT: This was in reply to your first post.

MG&TL
October 29th, 2012, 04:35 PM
Not going to flame here; but windows and linux compilers are totally different. I'd suggest getting used to that fast. :)

Generated by the compiler itself-what? You mean code-blocks generated code?

OpenGL apps- Oh lordy. How much do you know about OpenGL, and do you know whether you want to program with or without the extensions and 3.x features like shaders? Btw OpenGL is not a standard library (and I doubt it is on windows either)

General info:

-Linux has several (default) include paths. You're only looking in one. Just including <stdio.h> should work great.

-Don't download SDKs unless you need to. Use APT to install *-dev packages. Examples include libgl1-mesa-dev (the Mesa OpenGL headers), libgtk-3-dev (GTK+ 3.x development headers)....you get the point. This ain't windows. :)


Hints:

-Ditch both make and Code::Blocks (or IDE of any kind) and work with a plaintext editor and the command-line until you know what you're doing. Start simple, read the gcc manpage.

-What on earth are you doing with the X11 headers?

-Try not to think of anything to do with the windows way of doing things-I've used both, and thinking about one or the other doesn't work. Just use both ways.

Now, try a simple tutorial: http://www.network-theory.co.uk/docs/gccintro/gccintro_54.html and see how you get on.

dwhitney67
October 29th, 2012, 04:48 PM
So i looked in the standard directory (usr/local/include/) and i didnt found ANYTHING!

Um, you probably should check /usr/include ... this is the directory containing C header files. Also within it are the C++ header files (e.g. /usr/include/c++/4.6).

thedardanius
October 29th, 2012, 05:12 PM
Im not seeing anything

thedardanius
October 29th, 2012, 05:14 PM
I'm using xlib to create windows with glx extensions so I could create an "opengl window".
Yes linux is pretty much very different than windows. Sry about this newbieness. Its becuase I am ;p.
Can anyone give me a good tutorial about linux basics and diffrences between windows?
And what are -devs?
what are .so?

dwhitney67
October 29th, 2012, 05:21 PM
Im not seeing anything

Did you read this post (http://ubuntuforums.org/showpost.php?p=12324661&postcount=3)?

You need to install the C/C++ development tools. Not that it matters, but then the standard header files will be within /usr/include.

After installing the development tools, test out your system. Using an editor, such as gedit or kate, create a file called Hello.cpp. This file should contain the following:


#include <iostream>

int main()
{
std::cout << "Hello World." << std::endl;
}

After you have saved the file, open a terminal and go to where the file is saved. Enter the following command to compile/link the program:


g++ -Wall Hello.cpp -o hello

To run the program, enter the following command:


./hello


Please post back your results.


P.S. -devs, as mentioned earlier, was referring to the extension typically given to development packages that one can install using apt-get, whether from the command line or using synaptics (the graphical interface for installing packages).

The .so extension refers to shared-object. It is comparable to a DLL in *******.

thedardanius
October 29th, 2012, 08:32 PM
one prob: where to get the development tools? Where do I get sth in linux like in window's sdk?