Jump to content
  • Advertisement
Sign in to follow this  
_Sigma

Adding function to DLL - "identifier not found"

This topic is 4021 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Most likely a silly question. I have a DLL with one function. Its been working just fine. I needed to add another function, which I did. When I try to use it, I get "identifier not found". I appologize for the mostly undocumented code....:( DLL header
#ifndef _DEFINED_b349af11
#define _DEFINED_b349af11
#if _MSC_VER > 1000 
    #pragma once  
#endif // _MSC_VER > 1000

#ifdef __cplusplus 
extern "C" 
{ 
#endif // __cplusplus  
#ifdef _COMPILING_LIBSPEC
    #define LIBSPEC __declspec(dllexport)  
#else 
    #define LIBSPEC __declspec(dllimport) 
#endif // _COMPILING_uniqueheadername 
//
// Enter your Function-declarations as follows:
//
// LIBSPEC linkagetype resulttype name(parameters); 
 LIBSPEC int parse(float* list, char* line, int column);
 LIBSPEC int parseInteger(int* list, char* line, int column);

#undef LIBSPEC 
#ifdef __cplusplus 
} 
#endif // __cplusplus 
#endif // _DEFINED_uniqueheadername



DLL source
#define _COMPILING_LIBSPEC 1
#include "DllParser.h"

#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>

#include <string>
#include <fstream>

int parse(float* list, char* line, int column)
{
//source
}

//this is the new funciton
int parseInteger(int* list, char* line, int column)
{
///code
}



main
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <fstream>

#include "DllParser.h"
#include "windows.h"
int main(int argc, char *argv[]) 
{
	std::vector<std::vector<int>> vf;

	std::ifstream swe("C:\\Documents and Settings\\Chris\\Desktop\\Parser\\test\\veg.txt",std::ifstream::in);
	int r;
	if(!swe.good())
	{
		std::cout << "failed to open" << std::endl;
	}
	else
	{

	
	std::string line;
		

	int* in = (int*)malloc(sizeof(int)*3);
	
	for (int i =0; i<3;i++)//6 lines of header
	{
		getline( swe, line );
	}

	while( getline( swe, line ) )
	{

		
		 r = parseInteger(in,const_cast<char*>(line.c_str()),3); //this line
		
		switch(r)
		{
			case 1:
				{
					std::cout << "All is well" << std::endl;
					break;
				}
			case -1:
			{
				std::cout << "Invalid reg expression" << std::endl;
				break;
			}
			case -2:
				{
					std::cout << "bad cast occurred" << std::endl;
					break;
				}
			case -3:
				{
					std::cout << "Counters don't match - invalid output!" << std::endl;
					break;
				}


		}
	}
	}
	DWORD error = GetLastError();
	
	
	return 0;
}



error
2>c:\documents and settings\chris\desktop\parser\dllparser\parsertest\parsertest\main.cpp(37) : error C3861: 'parseInteger': identifier not found



I'm at a complete loss here. I replace parseInteger with parse, and its fine. Anything jump out at anyone? Cheers

Share this post


Link to post
Share on other sites
Advertisement
I'm getting this same message. I was actually getting it twice for two different functions. One of them was that the function was misspelled (stupid I know) but my definition was populate_events() but my call was populate_Events - this generated the error. My code looks similar to yours:

Here is the declaration in my h file:

#pragma once
#include "afxwin.h"
class CGUIDlg : public CDialog
{
// Construction
...
// Implementation
protected:
..
public:
BOOL processEventMsg(time_t TimeSec, UCHAR chan, int strtID, UCHAR *buf, int siz);
...
...
};

My function is written in the code as:

BOOL CGUIDlg::processEventMsg(time_t TimeSec, UCHAR chan, int strtID, UCHAR *buf, int siz)
{
...
}

And it is called in another function as:

void getAllRs232( int lr )
{
...
processEventMsg(TimeSec, (UCHAR)(lr+8),elmThree*32, adrs, length-1); //These variables have been declared and used
...
}

I thought it might be some sort of hidden unicode character that I wasn't catching but that seems really unlikely. If you solved this I would really like to know what you did!
Thanks.

Share this post


Link to post
Share on other sites
Ok, so I figured out my error, I hope this helps you out too, it's actually really simple, for me, the function void getAllRs232() was not part of my class. I declared it in my class header and defined it as void CGUIDlg::getAllRs232() and the program compiled!

Share this post


Link to post
Share on other sites
Whoa...Totally forgot about this thread!

I never actually sorted this out. Since it was for a small project, I ended up just hacking together on monster function with ways to control internally what function "version" it should use. Ugly and hacky, but it ended up working.

In response to your solution, I am not using any classes...so I don't see how that will help me.

Definitely appreciate you posting! Nice to know I'm not the only one with strange errors at times!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!