Computing.Net > Forums > Programming > using string::find() in C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

using string::find() in C++

Reply to Message Icon

Name: Edwin
Date: October 10, 2002 at 03:14:48 Pacific
OS: SunOS
CPU/Ram: UNW,Ultra-5_10
Comment:

Hi

I'm having some trouble compiling the program with string::find() using LEDA lib.
I got this error message during compilation
g++ -c -DDB_ORACLE -D__sun -Wall -Wstrict-prototypes -g -I../../include -I../../sql -I/vobs/prod/libs/comptellibs/include -I/vobs/prod/comptel/include -I/vobs/prod/external/include -I. ftm.cc -o SunOS/ftm.o
ftm.cc: In function `int main(int, char **)':
ftm.cc:777: no member function `leda_string::find(char[2])' defined
ftm.cc:780: no member function `leda_string::size()' defined
ftm.cc:782: no member function `leda_string::size()' defined
ftm.cc:782: no member function `leda_string::size()' defined
*** Error code 1
clearmake: Error: Build script failed for "SunOS/ftm.o"

My source code is
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

string host;
string port;

forall(host, server.FTCDHosts){
// ftcd_hosts may consist of port number, separate the host and port with a colon
int i;
i = host.find(":");
if (i != -1) {
//port.assign(host, i+1, host.size());
port.assign(host, i+1, host.size());
server.FtcdPort = port;
host.assign(host, 0, host.size() - port.size() -1);
} else {
server.FtcdPort = ftcd_port;
}
}

Thank You

Regards,
Edwin



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: October 10, 2002 at 09:08:40 Pacific
Reply:

My first guess would be that the LEDA library isn't being linked in. I would expect to see -L and/or -l parameters in your g++ command.

-L tells the compiler (linker) another directory to look in when looking for libraries (in addition to the directories it already knows). This is the library equivalent of the -I for include files.

-l tells the compiler (linker) what specific library to look for.


So if your LEDA lib was located at /usr/lib/leda/libleda.a, you would add

-L/usr/lib/leda -lleda

For the -L you add the path of the directory that library is located in and for the -l you strip the leading 'lib' and trailing '.a' from the library file name.

You specify only one directory or library with each -L and -l. So if you have five libraries spread between two different directories, you'd have two -L and five -l in your g++ command.


0
Reply to Message Icon

Related Posts

See More


g++ need to create a firewall...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: using string::find() in C++

How to use string array in C++? www.computing.net/answers/programming/how-to-use-string-array-in-c/9478.html

String connection in Unix/c++ www.computing.net/answers/programming/string-connection-in-unixc/3487.html

Using current time in C++ www.computing.net/answers/programming/using-current-time-in-c/14052.html