From: Kevin Nathan on 7 Sep 2009 18:46 On 07 Sep 2009 22:00:37 GMT joe cipale <j_cipale(a)yahoo.com> wrote: >Kevin, > >I just installed SuSE 11 on my laptop (dual-boot with Vista). The >install worked fine, but when I attempt to compile a program (c++ -g >-c <filename>.cpp) but I am getting errors trying to compile. For >whatever reason, the compiler is unable to find the .h files. > >I can find the files no problem. I have them in my path, but the >compiler is still bombing. Any ideas? > You can find all the header files you are requesting? Were they installed via YaST or by yourself? The header files do not need to be in your path, the compiler and linker look for them in particular places. As long as you installed via YaST, they should be correct. Do you have an example? -- Kevin Nathan (Arizona, USA) Linux Potpourri and a.o.l.s. FAQ -- (temporarily offline) Open standards. Open source. Open minds. The command line is the front line. Linux 2.6.25.20-0.5-pae 3:44pm up 17 days 23:39, 35 users, load average: 1.07, 1.04, 0.90
From: joe cipale on 7 Sep 2009 19:32 On Mon, 07 Sep 2009 15:46:06 -0700, Kevin Nathan wrote: > On 07 Sep 2009 22:00:37 GMT > joe cipale <j_cipale(a)yahoo.com> wrote: > >>Kevin, >> >>I just installed SuSE 11 on my laptop (dual-boot with Vista). The >>install worked fine, but when I attempt to compile a program (c++ -g -c >><filename>.cpp) but I am getting errors trying to compile. For whatever >>reason, the compiler is unable to find the .h files. >> >>I can find the files no problem. I have them in my path, but the >>compiler is still bombing. Any ideas? >> >> > You can find all the header files you are requesting? Were they > installed via YaST or by yourself? The header files do not need to be in > your path, the compiler and linker look for them in particular places. > As long as you installed via YaST, they should be correct. Do you have > an example? AN example of what, Kevin? Let me phrase it this way: I have a program I have been using since 4.1.3 was released. I have not had a problem with compiling it. I installed SuSE 11.0 and the mandatory C/C++ files. I am unable to compile the program at all now. If I write a simple Hello_world program with just "Hello WOrld!" (the std did I do things right? program), with just cout and endl using stdio.h and iostream.h, I get compiler errors. Subsequent searches show that, for whatever reason, the stdio.h file is in the /usr/include direcotry (as expected), but the iostream.h header is nowhere. There is a iostream file (simple text file), but no iostream.h file to be found. Here is the error I get: g++ -g -c -Wno-deprecated hello.cpp hello.cpp: In function 'int main()': hello.cpp:5: error: 'cout' was not declared in this scope hello.cpp:5: error: 'endl' was not declared in this scope Here is the source code: #include <stdlib.h> #include <iostream.h> main() { cout << "Hello World!" << endl; exit(0); } This program, after all, IS NOT rocket science. Is it? ;) I have been doing C/C++ code for many years but this is quite irritating. Nothing in the readme files have mentioned a change in the libraries. Besides, who the hell would do that and break other applications that currently work? Thanks for helping. Joe
From: Kevin Nathan on 7 Sep 2009 20:02 On 07 Sep 2009 23:32:37 GMT joe cipale <j_cipale(a)yahoo.com> wrote: >Here is the error I get: >g++ -g -c -Wno-deprecated hello.cpp >hello.cpp: In function âint main()â: >hello.cpp:5: error: âcoutâ was not declared in this scope >hello.cpp:5: error: âendlâ was not declared in this scope > >Here is the source code: >#include <stdlib.h> >#include <iostream.h> > >main() { > cout << "Hello World!" << endl; > exit(0); >} > > >This program, after all, IS NOT rocket science. Is it? ;) > It's been a few years since I have done any intensive C or C++ programming, although I did stumble through getting wm2 to compile under 11.0. I'm mostly doing Perl these days and when I *do* need to delve into C/C++, I tend to use KDevelop so I don't have to remember so many things . . . ;-) First of all, from what I remember, in C++ the headers don't use the .h extension -- <iostream.h> should be <iostream>. I tried this out with your code and that is still true. Also, I don't think using stdlib.h is correct for C++ anymore, but I could be mistaken on that one and I don't remember what the replacement is called (although I suppose it could be found in the docs or web). You also need a namespace declaration, which is no longer optional; although there might be a compiler switch to turn this off. Add in using namespace std; and it should work. Here is how I modified your code: ---------------------------------------------------------------- #include <stdlib.h> #include <iostream> using namespace std; main() { cout << "Hello World!" << endl; exit(0); } ---------------------------------------------------------------- and that should compile, with or without the '-Wno-deprecated' switch. >I have been doing C/C++ code for many years but this is quite >irritating. Nothing in the readme files have mentioned a change in the >libraries. The GNU compiler folks tend to make lots of changes between versions, but I believe it's mostly to get, or keep, current with the standards. >Besides, who the hell would do that and break other >applications that currently work? The GNU compiler folks! :-) But, in their defense, they usually have switches to mimic previous behaviors. > >Thanks for helping. You're most welcome . . . -- Kevin Nathan (Arizona, USA) Linux Potpourri and a.o.l.s. FAQ -- (temporarily offline) Open standards. Open source. Open minds. The command line is the front line. Linux 2.6.25.20-0.5-pae 4:48pm up 18 days 0:44, 35 users, load average: 0.95, 0.85, 0.78
From: joe cipale on 8 Sep 2009 00:22 On Mon, 07 Sep 2009 17:02:36 -0700, Kevin Nathan wrote: > On 07 Sep 2009 23:32:37 GMT > joe cipale <j_cipale(a)yahoo.com> wrote: > >>Here is the error I get: >>g++ -g -c -Wno-deprecated hello.cpp >>hello.cpp: In function �int main()�: hello.cpp:5: error: �cout� >>was not declared in this scope hello.cpp:5: error: �endl� was not >>declared in this scope >> >>Here is the source code: >>#include <stdlib.h> >>#include <iostream.h> >> >>main() { >> cout << "Hello World!" << endl; >> exit(0); >>} >>} >> >>This program, after all, IS NOT rocket science. Is it? ;) >> >> > It's been a few years since I have done any intensive C or C++ > programming, although I did stumble through getting wm2 to compile under > 11.0. I'm mostly doing Perl these days and when I *do* need to delve into > C/C++, I tend to use KDevelop so I don't have to remember so many things . > . . ;-) > > First of all, from what I remember, in C++ the headers don't use the .h > extension -- <iostream.h> should be <iostream>. I tried this out with your > code and that is still true. Also, I don't think using stdlib.h is correct > for C++ anymore, but I could be mistaken on that one and I don't remember > what the replacement is called (although I suppose it could be found in > the docs or web). > > You also need a namespace declaration, which is no longer optional; > although there might be a compiler switch to turn this off. Add in > > using namespace std; > > and it should work. Here is how I modified your code: > > ---------------------------------------------------------------- #include > <stdlib.h> > #include <iostream> > > using namespace std; > > main() { > cout << "Hello World!" << endl; > exit(0); > } > ---------------------------------------------------------------- > > and that should compile, with or without the '-Wno-deprecated' switch. > > >>I have been doing C/C++ code for many years but this is quite irritating. >>Nothing in the readme files have mentioned a change in the libraries. > > The GNU compiler folks tend to make lots of changes between versions, but > I believe it's mostly to get, or keep, current with the standards. > > >>Besides, who the hell would do that and break other applications that >>currently work? > > The GNU compiler folks! :-) But, in their defense, they usually have > switches to mimic previous behaviors. > > > >>Thanks for helping. > > You're most welcome . . . I had heard mention of using the namespace std declaration. The company I use to work for (thank you outsourcing of American Engineering jobs) did all of our development on older versions of RedHat, and thus C/C++. Ergo my compiler is, a tad outdayed, compared to what is now SOTA. Thanks for your help Kevin! Most appreciated, Joe
From: joe cipale on 8 Sep 2009 02:10
On Mon, 07 Sep 2009 17:02:36 -0700, Kevin Nathan wrote: > #include > <stdlib.h> > #include <iostream> > > using namespace std; > > main() { > cout << "Hello World!" << endl; > exit(0); > } Okay... this does compile. They problem I am seeing now is that when I attempt to run it, I get the following: /hello.o ../hello.o: Exec format error. Binary file not executable. When I check the file type, it looks okay: joec 15% >file hello.o hello.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped The compiler is v4.1.2 (on my ISPs machine. Mine is still reloading due to a kernel panic). |