newbie questions - please help me get started
I hope this is not a totally ignorant/stupid question, but please help me get started. I am fairly new to C++, brand new to C++ in *nix, and brand new to kdevelop. I am trying to get started with a file that a friend gave me and am unable to compile it. Hear is the #include section of the file: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> #include <alloc.h> #include <io.h> #include <sys/types.h> #include <sys/stat.h> #include <math.h> #include <sys/utsname.h> #include <search.h> #include <memory.h> #include <dir.h> #include <dos.h> #include "ri40file.hpp" and here are the compiler ouput messages that I am getting: *cd "/home/big_bear/rid_dev/cpp/wmc/ptcdump/debug/src" && WANT_AUTOCONF_2_5="1" WANT_AUTOMAKE_1_6="1" gmake -k ptcdump.lo *if /bin/sh ../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I/home/big_bear/rid_dev/cpp/wmc/ptcdump/src -I.. -O0 -g3 -MT ptcdump.lo -MD -MP -MF ".deps/ptcdump.Tpo" -c -o ptcdump.lo `test -f '/home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp' || echo '/home/big_bear/rid_dev/cpp/wmc/ptcdump/src/'`/home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp; then mv -f ".deps/ptcdump.Tpo" ".deps/ptcdump.Plo"; else rm -f ".deps/ptcdump.Tpo"; exit 1; fi *g++ -DHAVE_CONFIG_H -I. -I/home/big_bear/rid_dev/cpp/wmc/ptcdump/src -I.. -O0 -g3 -MT ptcdump.lo -MD -MP -MF .deps/ptcdump.Tpo -c /home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp -fPIC *In file included from /usr/include/g++/backward/alloc.h:46, *from /home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:20: */usr/include/g++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:21:16: io.h: No such file or directory */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:28:17: dir.h: No such file or directory */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:29:17: dos.h: No such file or directory */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp: In function `int *ReadSortFile(char*)': */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:414: error: `_popen' undeclared (first use this function) */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:414: error: (Each undeclared identifier is reported only once for each function it appears in.) */home/big_bear/rid_dev/cpp/wmc/ptcdump/src/ptcdump.cpp:422: error: `_pclose' undeclared (first use this function) *gmake: *** [ptcdump.lo] Error 1 **** Exited with status: 2 *** I checked the system and the .h files that the compiler says it cannot find seem to be there. Example: io.h is located at /usr/include/sys/io.h. The only exception might be the dos.h which only exists in a Kylix3 directory. Do I have some configuration done incorrectly? Will someone give me a kick start here? Thanks, DC
I checked the system and the .h files that the compiler says it cannot find seem to be there. Example: io.h is located at /usr/include/sys/io.h.
So you need to "#include <sys/io.h>" or pass -I/usr/include/sys option to compiler. Similarly for other header files.
The only exception might be the dos.h which only exists in a Kylix3 directory.
So you need to pass -I/path/to/Kylix3 to compiler.
Darrell Cormier wrote:
I checked the system and the .h files that the compiler says it cannot find seem to be there. Example: io.h is located at /usr/include/sys/io.h. The only exception might be the dos.h which only exists in a Kylix3 directory.
Do I have some configuration done incorrectly? Will someone give me a kick start here?
You might get away with changing #include<io.h> #include<dir.h> to #include<sys/io.h> #include<sys/dir.h> This looks like a gnu build using a ./configure and make. If so, you might can try LDFLAGS=/usr/local/wibble/lib CPPFLAGS=/usr/local/wibble/include ./configure assuming dos.h and the library it refers to are contained in /usr/local/wibble/include and /usr/local/wibble/lib You can ignore the rest of the warnings for now: the new standard way of using C++ headers is to use (for example) #include<iostream> instead of #include<iostream.h> whenever possible. This encloses the standard library in a namespace. A lot of programs immediately follow this with using namespace std; which rather defeats the purpose. These warnings also tell me you must be using a recent version of SuSE and so actually do have gnu make (gmake) version at least 1.6. -- JDL Non enim propter gloriam, diuicias aut honores pugnamus set propter libertatem solummodo quam Nemo bonus nisi simul cum vita amittit.
participants (3)
-
Darrell Cormier
-
John Lamb
-
kamal