I have run into an odd situation with linking files in my application. I have written a method that returns data for other methods. When I use this method(with in the same class) I get this error from linking.

Any help with this is greatly appreciated

RetsParse.cpp: undefined reference to `RetsParse::rets_parse_metadata(boost::shared_ptr<librets::RetsSession>)'

Here is my current code base.

.h;

#ifndef RETSPARSE_H_
#define RETSPARSE_H_

#include "librets.h"
#include <iostream>
#include <string>
#include <vector>


class RetsParse
{
public:
	int rets_parse_idx(void);// public method to parse rets data;
	std::vector<std::vector<std::string> > rets_parse_metadata(librets::RetsSessionPtr session); 
};

#endif /*RETSPARSE_H_*/

.cpp

int rets_parse_idx(void){
			
			RetsParse metaAction;
			
			// Define session request
	        librets::RetsSessionPtr session(new librets::RetsSession("URL"));
	        session->Login("USER", "PASS");
	        
	        std::vector<std::vector<std::string> > metaVector = metaAction.rets_parse_metadata(session);
	        
	        std::cout << metaVector.size() << std::endl;
        
	        return 0;

	}

MakeFile

# =========================================================================
#     This makefile was generated by
#     Bakefile 0.2.5 (http://www.bakefile.org)
#     Do not modify, all changes will be overwritten!
# =========================================================================



# -------------------------------------------------------------------------
# These are configurable options:
# -------------------------------------------------------------------------

# C++ compiler 
CXX = g++

# Standard flags for C++ 
CXXFLAGS ?= 

# Standard preprocessor flags (common for CC and CXX) 
CPPFLAGS ?= 

# Standard linker flags 
LDFLAGS ?= 

# Set to 1 to build debug version [0,1]
DEBUG ?= 0



# -------------------------------------------------------------------------
# Do not modify the rest of this file!
# -------------------------------------------------------------------------

### Variables: ###

CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
RETSCOMM_CXXFLAGS = $(____DEBUG_0_p) $(____DEBUG_1_2) $(____DEBUG_3) \
	-Ilib -I/usr/include/mysql \
	-I/usr/local/include/mysql++$(CPPFLAGS) $(CXXFLAGS)
RETSCOMM_OBJECTS =  \
	retsComm_retsComm.o \
	retsComm_DbConnect.o \
	retsComm_DataParse.o \
	retsComm_RetsParse.o

### Conditionally set variables: ###

ifeq ($(DEBUG),0)
____DEBUG_0_p = -DNDEBUG
endif
ifeq ($(DEBUG),1)
____DEBUG_0_p = 
endif
ifeq ($(DEBUG),0)
____DEBUG_1_2 = -O2
endif
ifeq ($(DEBUG),1)
____DEBUG_1_2 = -O0
endif
ifeq ($(DEBUG),0)
____DEBUG_3 = 
endif
ifeq ($(DEBUG),1)
____DEBUG_3 = -g
endif


### Targets: ###

all: retsComm

install: 

uninstall: 

clean: 
	rm -f ./*.o
	rm -f ./*.d
	rm -f retsComm

retsComm: $(RETSCOMM_OBJECTS)
	$(CXX) -o $@ $(RETSCOMM_OBJECTS)  $(____DEBUG_3) $(LDFLAGS) -lmysqlpp -lmysqlclient `/usr/local/bin/librets-config --libs`

retsComm_retsComm.o: ./retsComm.cpp
	$(CXX) -c -o $@ $(RETSCOMM_CXXFLAGS) $(CPPDEPS) $<

retsComm_DbConnect.o: ./DbConnect.cpp
	$(CXX) -c -o $@ $(RETSCOMM_CXXFLAGS) $(CPPDEPS) $<
	
retsComm_DataParse.o: ./DataParse.cpp
	$(CXX) -c -o $@ $(RETSCOMM_CXXFLAGS) $(CPPDEPS) $<
	
retsComm_RetsParse.o: ./RetsParse.cpp
	$(CXX) -c -o $@ $(RETSCOMM_CXXFLAGS) $(CPPDEPS) $<

.PHONY: all install uninstall clean


# Dependencies tracking:
-include ./*.d

All I see in the code you posted is the function prototype for that function -- where in *.cpp or *.h file is the implementation code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.