Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to Visual C++. I am trying to make a simple DLL for my practice. My coding is as follows:
CB.CPP
C#
#include "stdafx.h"
#include "CB.h"



extern "C" EXPORT int WINAPI sum (int x, int y)//C2144 and C4430

{
    return x+y;
}


and CB.H
C#
#define CBExport __declspec(dllexport)

#ifdef __cplusplus
extern "C"
{
#endif

extern "C" EXPORT int WINAPI sum (int x, int y);//C2144 and C4430

#ifdef __cplusplus
}
#endif


I am receiving the errors C4430 and C2144 while trying to build this prog. The C2144 error is as follows:
1>d:\context broker\cb\cb\cb\cb.h(14) : error C2144: syntax error : 'int' should be preceded by ';'
and C4330 error is follows:
1>d:\context broker\cb\cb\cb\cb.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Posted

1 solution

change from
JanuSatish wrote:
#define CBExport __declspec(dllexport)

to
C++
#define EXPORT __declspec(dllexport)



BTW you shouldn't duplicate the 'extern' clause.
 
Share this answer
 
v2
Comments
JanuSatish 20-Feb-12 3:03am    
I am getting the error still:(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900