C4430 error building DLL

I'm trying out DLLs for the first time and have a previously written text function program I'm converting to use as a DLL so other programs can use the functions.

Unfortunately, the build fails with the following errors:

1>StringFunctions.cpp
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(26): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(26): error C2143: syntax error: missing ',' before '&'
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(30): error C2143: syntax error: missing ',' before '&'
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(33): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(33): error C2143: syntax error: missing ',' before '&'
1>e:\tech\programming\c++\solutionstrfunc\strfunc\stringfunctions.h(37): error C2061: syntax error: identifier 'string'

The start of the code in the header file is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once


//#ifndef STRFUNC_DYNAMIC_LIBRARY_H
//#define STRFUNC_DYNAMIC_LIBRARY_H

#ifdef STRFUNCDYNAMICLIBRARY_EXPORTS
#define API_STRFUNC_DYNAMIC_LIBRARY __declspec(dllexport)
#else
#define API_STRFUNC_DYNAMIC_LIBRARY __declspec(dllimport)

#endif

#include <string>

class API_STRFUNC_DYNAMIC_LIBRARY StringFunctions
{
public:
	// Constructor and Destructor
	StringFunctions( );
	~StringFunctions( );

	// String Functions ...

	// Return number of whitespace & punctuation delimited words in a string
	long Words( const string& text);

	// Return in a reference string the wordNum'th' word in text. 
	// Function return is true if successful and false otherwise
	bool Word( const string& text, const int wordNum, string& returnString );

	// Return the word position of srchWord in text. precision defines if case is significant (true for yes)
	long WordPos( const string& text, const string& srchWord, bool precision = true );



Does anyone have any ideas why? I can't find anything useful bearing in mind the code in the .cpp file works fine in a standard console application and the function declarations were taken direct from that.
Last edited on
do you need to put std:: in front of those strings, or try using std::string after includes?
OMG! That worked. Thank you, Jonnin :-)

Such a stupid error to make. Of course, in the console version there was a "using namespace std" at the top which I just didn't copy across. Feel a fool now! But at least it's working.
in the console version there was a "using namespace std" at the top
Avoid placing using directives at namespace scope in a header file.
Sorry, it didn't. It had:

using std::string
Topic archived. No new replies allowed.