Jump to content
Deltanoob

Linux C++ Programing Tutorials

Recommended Posts

I have heard that linux is a great OS to program in.

I have been trying to learn C++, but i can't find any tutorials for c++ for linux users, they all use windows compilers :( .

So anyone know where i can find a good programing tutorial for linux users? or maybe where i can get a simple C++ compiler for linux? pls help.

Ty

LONG LIVE LINUX!!!!!!!!!!!!!!!!!!!!

  • Like 10

Share this post


Link to post
Share on other sites

looks like you just need compiler for running your c++ progs .. which linux distro are you using?

Share this post


Link to post
Share on other sites

You seem to be confusing two things here - a windows tutorial for PROGRAMMING C++ is just as valid a a Linux tutorial - it is, after all, just the programming side you're interested in.

 

In terms of the compiling, there are many compilers out there: gcc, yacc, etc. Remember that the compiling and linking part is only a small bit of what programming entails.

Share this post


Link to post
Share on other sites

"C++ Programming in easy steps" By Mike Mcgrath.

 

It makes use of g++ and is aimed at both Linux and Windows. (That is, how to compile on each one. Code is the same as said above.)

Share this post


Link to post
Share on other sites

I also have a question about programming on linux, I hope I'm not being too rude by hijacking this post...

 

I haven't coded for a while and it's time for me to get back at it. Damn I'm rusty. I'm now living at home exclusively on linux (still on windows at the office) but, as one of you said, this make (almost) no difference code-wise.

 

So, I've installed g++. Works as expected. Then I gave a try to Code::Blocks and Geany, they're both interesting and useful, really good IDE. So I'm ready to rock. I'm doing "Hello world!" app like there is no tomorrow. Even really improved version that can ask for your name and reply to you directly.

 

But, as you may guess, I'm not just here to brag about my awesome programming skill. The problem I have is with OpenGl. I have installed my required library, I can see them in ~/usr/include/GL, I start my code with an #include <GL/glut.h> but when I compile I get those error for every gl function I try to call (ex: "main.cpp:(.text+0x458): undefined reference to `glutMainLoop'"). I tough that /usr/include was in the default search directory... but may be the problem is something else. I plan on using a lot OpenGl so it would great if it could just work when I hit the compile button.

If any of you can help me, I would be really grateful.

 

Thank You,

Max Boivin

Share this post


Link to post
Share on other sites

okay - this sounds more like a PATH or module compile issue, as you mentioned, as the compiler can't see the mods to link them into.

 

And.... that's about the limit of my knowledge.

 

The only other thing I can suggest is to use a common module or library that you definitely know and love, and pop that into /usr/include (or wherever) then try compiling using one of those includes - the aim being that you know it SHOULD work, but it's a path/modpath/include issue that needs resolving.

 

I know it doesn't sound like much help, but I had the same issue with Java. I dropped back to a known JAR and kept moving it around until I managed to work out a correct location and specific CLASSPATH that would allow it to all work. From that point, I found that if I dropped any custom JAR files into that location, they would be included during the compile.

 

That's all from me at that point.. I ain't a C++ programmer, sorry!

Share this post


Link to post
Share on other sites

Thanks for the advice. It was indeed a good idea to try moving a know library to a different folder. The problem seems to be related to g++. It doesn't seem to look in any folder... so, there's no library working if I don't specify to the compiler where to get them. So the thing I would like to know is how can I have add some folder to the default search path of gcc.

I hope one of you will be able to help me and that it's gonna solve my problem.

 

Thank you for your time,

 

Max Boivin.

Share this post


Link to post
Share on other sites

I'm by no means a C++ programming expert either, but I wonder if LD_LIBRARY_PATH might be what you're looking for? It is an environment variable that contains a colon-separated list of directories to look for shared libraries.

 

export LD_LIBRARY_PATH="/your/path/to/include/GL:${LD_LIBRARY_PATH}"

 

and then try invoking g++ again?

 

Again, I'm not sure if this is the right suggestion, but it might be worth a try.

Share this post


Link to post
Share on other sites

×
×
  • Create New...