Hi All,
Please Help me out with this below mentioned error.

librohit.a: undefined reference to `MODEL_NAME'
librohit.a: undefined reference to `FT_MODEL'
librohit.a: undefined reference to `STOCK_MODEL'
librohit.a: undefined reference to `FUTURE_MODEL'
librohit.a: undefined reference to `COArgs::COArgs()'
librohit.a: undefined reference to `std::strstreambuf::freeze(int)'
librohit.a: undefined reference to `RWMutex::wLock()'
librohit.a: undefined reference to `OUTSTRIKE_PARAMETERS'
librohit.a: undefined reference to `sec_login_sql_client'
librohit.a: undefined reference to `sec_login_ctor'
librohit.a: undefined reference to `RWMutex::wUnlock()'
librohit.a: undefined reference to `RWMutex::rLock()'
librohit.a: undefined reference to `RWMutex::rUnlock()'
librohit.a: undefined reference to `String::String(char)'
librohit.a: undefined reference to `String::hashval() const'
collect2: ld returned 1 exit status

Thanks
Rohit

I am trying to build exe bbut getting the following above said error..
I am tring to build below mention code.

#include <iostream>
#include <fstream.h>
#include <stdlib.h>

#include "RohitSahni/String.h"

using namespace std;
int main(int argc, char **argv)
{
			String testString("Hellow");
			cout << "*********"<<testString.c_str();
			
			
    			
   }

In the above code i have defined my own String claa inherited from std::string.

Plz Help

Thanks
Rohit

Comments
Thanks for using code tags

line 2: unless you are using a very old compiler such as the original Turbo c++ you should be using header files without the .h extension because there have been some changes.

You should have named your derived string something other than String.h because that is already the name of standard C string functions. Its not good to duplicate file names like that because it will eventually become confusing.

My guess about your specific problem is that you did not include one or more required libraries in the project. Did you include the implementation code for your derived class ?

This article has been dead for over six months. Start a new discussion instead.