Compiling error while compiling VC++ code on Ubuntu using GCC

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiling error while compiling VC++ code on Ubuntu using GCC

Raman
Hi i develop a program on c using VSTS2010. it is compiling fine on window. bt with the same code whwn i am compiling it on linux it through error


expected constructor, destructor, or type conversion before â(â token
In file included from CRuntimeDll.cpp:13:
CRuntime.h:5: error: expected constructor, destructor, or type conversion before â(â token



Please help asap...

thx
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Soundararajan
Can you paste that code fragment here ?



--
View this message in context: http://gcc.1065356.n5.nabble.com/Compiling-error-while-compiling-VC-code-on-Ubuntu-using-GCC-tp958768p958771.html
Sent from the gcc - Help mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Raman
#ifdef _WIN32
#include "stdafx.h"
#endif

#include "CRuntimeDll.h"


#include <stdlib.h>
//#include <string.h>
//#include <ctype.h>
#include "CRuntime.h"
#include "cloudruntime.h"

#define MAXFailureReasonSize 100

#ifndef RT_3_3
        #define RT_3_3
#endif
//#undef RT_3_3

CRUNTIMEDLL_API int acquireLicenseClient()
{
        int status=-1;
        status=scr_acquireLicenseClient();
        return status;
}
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Raman
#ifdef CRUNTIMEDLL_EXPORTS
#ifdef _WIN32
#define CRUNTIMEDLL_API extern "C" __declspec(dllexport)
#else
#defineCRUNTIMEDLL_API extern "C"
#endif
#else
Runtimedll.h file contains below mention code:



#ifdef _WIN32
#define CRUNTIMEDLL_API __declspec(dllimport)
#else
#define CRUNTIMEDLL_API
#endif
#endif

// This class is exported from the CRuntimeDll.dll
class CCRuntimeDll {
public:
        CCRuntimeDll(void);
        // TODO: add your methods here.
};

extern int nCRuntimeDll;

CRUNTIMEDLL_API int fnCRuntimeDll(void);
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Jonathan Wakely-4
On 7 August 2013 09:19, Raman wrote:
> #ifdef CRUNTIMEDLL_EXPORTS
> #ifdef _WIN32
> #define CRUNTIMEDLL_API extern "C" __declspec(dllexport)
> #else
> #defineCRUNTIMEDLL_API extern "C"

Did you read the error message? It tells you there's an error on the
line above, which should be obvious: it's missing a space.
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Raman
now i am getting error message :

CRuntimeDll.cpp: In function âint getInfoInC(char*, char*, char*, char*, char*, int, scr_Entitlement_t**, char**)â:
CRuntimeDll.cpp:48: error: â_stricmpâ was not declared in this scope


On Wed, Aug 7, 2013 at 2:03 PM, Jonathan Wakely-4 [via gcc] <[hidden email]> wrote:
On 7 August 2013 09:19, Raman wrote:
> #ifdef CRUNTIMEDLL_EXPORTS
> #ifdef _WIN32
> #define CRUNTIMEDLL_API extern "C" __declspec(dllexport)
> #else
> #defineCRUNTIMEDLL_API extern "C"

Did you read the error message? It tells you there's an error on the
line above, which should be obvious: it's missing a space.



If you reply to this email, your message will be added to the discussion below:
http://gcc.1065356.n5.nabble.com/Compiling-error-while-compiling-VC-code-on-Ubuntu-using-GCC-tp958768p958791.html
To unsubscribe from Compiling error while compiling VC++ code on Ubuntu using GCC, click here.
NAML



--
Regards

RAMAN
91 8010673433
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Jonathan Wakely-4
On 7 August 2013 09:38, Raman wrote:
> now i am getting error message :
>
> CRuntimeDll.cpp: In function âint getInfoInC(char*, char*, char*, char*,
> char*, int, scr_Entitlement_t**, char**)â:
> CRuntimeDll.cpp:48: error: â_stricmpâ was not declared in this scope

That function only exists on Windows, you can use strcasecmp instead
on GNU/Linux.
Reply | Threaded
Open this post in threaded view
|

RE: Compiling error while compiling VC++ code on Ubuntu using GCC

Andy Falanga (afalanga)
In reply to this post by Raman
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Raman
> Sent: Wednesday, August 07, 2013 12:14 AM
> To: [hidden email]
> Subject: Compiling error while compiling VC++ code on Ubuntu using GCC
>
> Hi i develop a program on c using VSTS2010. it is compiling fine on
> window.
> bt with the same code whwn i am compiling it on linux it through error
>
>
> expected constructor, destructor, or type conversion before â(â token
> In file included from CRuntimeDll.cpp:13:
> CRuntime.h:5: error: expected constructor, destructor, or type
> conversion before â(â token
>


Not sure if this one was answered but one thing I now know to look for is that the Microsoft compiler will often times allow much that GCC will not.  For example, on the project I'm working on now, our team was oft doing things like:

throw std::exception("Something went wrong")

For kicks and giggles one day I decided to try an idea using GCC and did something similar.  I then found out that the STL *doesn't* define a ctor for std::exception which takes a string (either a char* or std::string) object.  Microsoft's implementation of the STL allowed for such (I word it this way because I don't think it's something that was put into their compiler per se).  Your problem referenced there may be nothing more than a generous allowance from Microsoft that isn't standard and, thus, not portable.  The error message provided sounds similar: i.e. whatever is on line #5 of that file is probably code that isn't standard conforming but Microsoft helps you in doing what you're after  (I'm not sure if that's the file you provided, and one of those you provided was poorly formatted, probably Outlook's fault not yours).

Andy
Reply | Threaded
Open this post in threaded view
|

Re: Compiling error while compiling VC++ code on Ubuntu using GCC

Jonathan Wakely-4
On 7 August 2013 16:09, Andy Falanga (afalanga) wrote:
>
> Not sure if this one was answered

It was.

> Your problem referenced there may be nothing more than a generous allowance from Microsoft that isn't standard and, thus, not portable.  The error message provided sounds similar: i.e. whatever is on line #5 of that file is probably code that isn't standard conforming but Microsoft helps you in doing what you're after  (I'm not sure if that's the file you provided, and one of those you provided was poorly formatted, probably Outlook's fault not yours).

No, the problem was basically:

#ifdef _MSC_VER
// valid code
#else
nonsense
#endif