Member Avatar for harsh2327

Hey,

I have just upgraded my C++ compiler from old TurboC++ to CodeBlocks as per Salem's suggestion. (Check this post)


But I am finding difficult to work with this compiler for the basic reason of not knowing the in-built functions.

Can you please help me with this by listing down the functions' syntax and their use.

Recommended Answers

All 9 Replies

It doesn't have anything specific. Just don't use anything that isn't standard C.

> not knowing the in-built functions.
The only functions worth knowing are those in stdio.h, stdlib.h etc.

Anything else (say conio.h and dos.h) has to be re-learnt every time you change OS/Compiler (which you'll do many times, so get used to it).

Learning the boundary between "portable" and "implementation specific" will save you an awful lot of grief in the long run. It's unfortunate that you started by learning an implementation rather than the language.

CodeBlocks is an IDE that can be used with most any compiler. But it is not a compiler, itself. its just a shell. so you need to use CodeBlocks in conjunction with a compiler, and preferrably one that, unlike Turbo C, is tightly bound to the ANSI standard.

I think your problem is that you may be using CodeBlocks without having a compiler associated with it, and it's attempting to default to a GCC compiler.

Since you dont have a GCC compiler (i assume you're on Windows), your code is not being recognized.

here's the quickest way to get started:

Since (I assume) you're on a Windows machine, get the MS VisualC++ Express Edition free compiler (download here) and use it as the preferred compiler in CodeBlocks. you can select which compiler is being used from the toolbar "SETTINGS -> Compiler and Debugger" menu

then quit using any function that requires libraries -- like the dreaded "conio.h", "dos.h", or even "windows.h" -- and constrain yourself to writing code using only standard ANSI C. short-term difficulty, yes, but long-term rewards.

even then, you'll probably still have some problems porting code you've written against the MSVC compiler to a real ANSI compiler like GCC, but it the problems will be a few minor details rather than a ton of major code rewrites.

now the only problem with this setup I've described is that I dont think the free (express) version of MSVC has a debugger available.

i think better options would be to use CodeBlocks with either the MinGW compiler for windows, or the Cygwin GCC compiler for windows. i haven't gotten it to work for myself, yet, but i havent spent much time trying either.


guestion for Salem: which compiler(s) do you use with Codeblocks?

.

For windows installations codeblocks usually contains the C++ compiler and some other compilers from GCC compiler collections and the GDB debugger from MinGW. This is an outstanding c++ compiler what is also available on unix and mac os. proprietary turbo c++ can not be compared with this ISO standard and posix compatible compiler.
Unfortunately, this IDE, written in Delphi/Kylix, has still some serious bugs, therefore efficient working is sometimes restricted. That s the reason why I am still using wxDev-C++.

really? you mean the CodeBlock IDE contains a GCC compiler on fresh installation?

well, damn, if that's the case, everyone please ignore my previous post.

:-O

hmm... rechecking this... i dont think Code:Blocks comes with a compiler. it comes with the *ability* to use multiple compilers, but you have to provide them. if you dont provide your own, it defaults to expect the GCC compiler which, as far as I'm aware, doesnt exist on windows.

AFAIK, the only GCC-style compilers that works on windows are MinGW and Cygwin, and you've got to go get them yourself.

For Windows users, the easiest/quickes way to get started is to use the free MSVC compiler, Code:Blocks will detect it automatically. (downside is no debugger available with the free compiler)

MinGW might be a better option, tho I havent tried it yet. I briefly tried to get it to find my Cygwin GCC implementation, but haven't had time to work it out.

personally i just use MSVC with CodeBlocks on my windows machine (or just plain old Cygwin if necessary), and I use GCC with CodeBlocks on my linux machine. one day ill spend some time and make them more compatable.


.

hmm... rechecking this... i dont think Code:Blocks comes with a compiler. it comes with the *ability* to use multiple compilers, but you have to provide them. if you dont provide your own, it defaults to expect the GCC compiler which, as far as I'm aware, doesnt exist on windows.
.

I don't think so.

commented: thanks for schooling me on that. i should try and shut up more often.... well, probably not.... +2

oh... it has a MinGW-included setup

aha, i missed that. i used a direct link to the vanilla setup.

sorry

I'll shut up now

:$


.

. . .
Can you please help me with this by listing down the functions' syntax and their use.

Returning to the charge of harsh2327 s request, I personally think that http://www.cppreference.com/ offers a rather complete reference on c++. If you want to know something more about gcc, what is really much more than c++ only, http://gcc.gnu.org/onlinedocs/ would be a good resource.

krs,
tesu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.