![]() |
| | #1 |
| Registered User Join Date: May 2008
Posts: 16
| Dev-C++ compiler problem I am currently using: Windown XP 2002 Pro with Service Pack 2 Dev-C++ Version 4.9.9.2 I am new to programming and I am learning from a book call "C++ All-in-one Desk reference for dummies" by Jeff Cogswell. I tried to use the code provided to see how the language works. The book uses version 4.9.9.0. I loaded the code which is all in the same project, and i have some compiler error that i do not understand. Please help! The code and error messages are displayed below Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
int main(int argc, char *argv[])
{
int NumberOfPotholes = 532587;
NumberOfPotholes = 6087;
int *ptr;
ptr = &NumberOfPotholes;
*ptr = 6087;
cout << NumberOfPotholes << endl;
cout << &NumberOfPotholes << endl;
cout << ptr << endl;
system("PAUSE");
return 0;
}
cannot find -lobjc ld returned 1 exit status [Build Error] [Pointer1.exe] Error 1 Any help is much appreaciated, I am getting a bit frustrated with programming, so if anyone knows any smarter way to learn C++, that will be great too. Regards Grasshopper Esq. |
| GrasshopperEsq is offline | |
| | #2 |
| Its hard... But im here Join Date: Apr 2005 Location: England
Posts: 1,466
| Erm the version of Dev the book comes with is very old. And that program is quite advanced for a starting point. I advise getting Visual C++ 2008 Express which is free download from Microsoft website. -lobjc looks like an "object" or part of the run exe file that it cannot locate. I would almost certainly consider getting a better IDE/compiler for later use, as Dev is ok but its badly bugged
__________________ I'm just trying to be a better person - My Name Is Earl |
| swgh is offline | |
| | #3 |
| Registered User Join Date: May 2008
Posts: 16
| Thank you for the reply, may i ask is there much difference between using Visual C++ 2008 and using Dev-C++? I had a quick look around the web, it seem to be a problem with the compiler according to some forum. I have only just pick the language up from yesterday, so i am still quite new and not very experience. Thank you again |
| GrasshopperEsq is offline | |
| | #4 |
| Its hard... But im here Join Date: Apr 2005 Location: England
Posts: 1,466
| Visual C++ is much larger than Dev as an IDE. It has lots of features that Dev doesnt have, but as you are just starting out, then that isnt a problem, as most of it you would never use untill you were quite experienced in the language syntax. I would also reomend you starting with a much simpler program, somthing like: Code: #include <iostream>
int main()
{
std::cout << "Hello World!\n";
std::cin.get();
return 0;
}
__________________ I'm just trying to be a better person - My Name Is Earl |
| swgh is offline | |
| | #5 |
| Registered User Join Date: May 2008
Posts: 16
| Thank you so much I will try to download the Visual C++, do you know any good resource for learning this program? |
| GrasshopperEsq is offline | |
| | #6 |
| Registered User Join Date: Feb 2008 Location: Lehi, UT
Posts: 179
| Don't listen to him. Dev C++ should have been able to compile that program fine. I would recommend, however, uninstalling it and downloading the latests version from blodshed. Of course, you could always install code::Blocks if you want something that's a bit more up to date.
__________________ Type-ins are back! Visit Cymon's Games at http://www.cymonsgames.com for a new game every week! |
| guesst is offline | |
| | #7 |
| Its hard... But im here Join Date: Apr 2005 Location: England
Posts: 1,466
| Thats rather rude. I was only offering advice which I am fully entitled to do on a forum, whether the OP chooses to take the advice is up to them.
__________________ I'm just trying to be a better person - My Name Is Earl |
| swgh is offline | |
| | #8 |
| Registered User Join Date: May 2008
Posts: 16
| I appreciated all the help, where can i install code::blocks? |
| GrasshopperEsq is offline | |
| | #9 |
| Registered User Join Date: May 2008
Posts: 16
| Thank you both for your help, I have tried and retyped the code, and it seems to work, i wonder if there is anything to do with the end of line character between different system. any ideas? |
| GrasshopperEsq is offline | |
| | #10 |
| Registered User Join Date: Dec 2006
Posts: 1,780
| if you are doing everything on the same platform (coding and compiling), it shouldn't be the problem. I even occassionally code on Linux and compile and Windows and vice versa and there doesn't seem to be any problems either. I am assuming compilers (parsers) are smart enough to figure it out. BTW, I second Code::Blocks (google will tell you where to download). Since your book uses Dev-C++, which uses GCC as its compiler, it will probably be a good idea (at least when you are starting off) to stick with an IDE that also uses GCC (such as Code::Blocks, and not VC++, which uses Microsoft's own compiler). |
| cyberfish is offline | |
| | #11 |
| Registered User Join Date: Dec 2006
Posts: 1,780
| although theoretically, as long as you write standard C++, any compiler will work, practically, every compiler has its own quirks. |
| cyberfish is offline | |
| | #12 |
| Registered User Join Date: May 2008
Posts: 16
| Well, the funny thing is, when i actually type the code in instead of cut and paste, it works! Now i am even more confuse. but i will give code::blocks a try! thanks mate |
| GrasshopperEsq is offline | |
| | #13 |
| Its hard... But im here Join Date: Apr 2005 Location: England
Posts: 1,466
| You will learn a great deal more by typing the code in yourself rather than copy/paste too. This is a good ideal to cling to for later learning practices. When you learn somthing new, you type it as it says in a book and may think "I wonder how this works..." as you type it. It then encourages you to dive deeper into how certain aspects and algorithms of the language work.
__________________ I'm just trying to be a better person - My Name Is Earl |
| swgh is offline | |
| | #14 |
| Banned Join Date: Aug 2001 Location: Visalia, CA, USA
Posts: 3,699
| Though I am not quite compelled to jump on the Microsoft bandwagen, I would like to point out that Dev-C++ is seriously out of date. And to answer the original question (which no one has even bothered to take the time to do as of yet). You are actually dealing with a known issue with the MinGW compiler on Windoze Vi$ta. What you need to do is edit your path to include the folders which contain gcc (and mingw32-gcc) as well as c1, and ld. Using the crappy vista search tool will likely not find any of these files since m$ has a very buggy file indexing system in all of its current OSes. You are looking for folders something like C:\MinGW\bin and C:\MinGW\libexec\gcc\mingw32\3.4.5 (or whatever version... this is what mine is set to atm anyway). Good luck. |
| master5001 is offline | |
| | #15 |
| Registered User Join Date: May 2008
Posts: 21
| I'm taking a C++ class and they recommend Dev C++ for beginners because it's easier to use than Visual C++ and more user friendly. Last edited by slimdime; 05-03-2008 at 09:11 AM. |
| slimdime is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Weird compiler (Dev) | gavra | C Programming | 11 | 08-03-2008 01:19 AM |
| Starting with Dev C ; a problem | mabauti | C++ Programming | 18 | 12-05-2007 11:16 AM |
| added start menu crashes game | avgprogamerjoe | Game Programming | 6 | 08-29-2007 01:30 PM |
| Dev C++ Compiler - True or false? | JamesF | General Discussions | 6 | 07-10-2006 11:03 AM |
| Comile problem using latest Dev C++ Compiler | shiny_dico_ball | C++ Programming | 6 | 06-06-2003 05:32 PM |