473,406 Members | 2,847 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C linkage problem with ACE on windows

Compiling a program using ACE + MSVC++8, got lots of errors and some
are listed as below:

Error 2 error C2894: templates cannot be declared to have 'C'
linkage c:\program files\microsoft visual studio
8\vc\include\iosfwd 39
Error 39 error C2733: second C linkage of overloaded function
'ACE_OS::atoi' not
allowed c:\tmp\ace+tao+ciao\ace_wrappers\ace\os_ns_stdlib. h 79
Error 41 error C2733: second C linkage of overloaded function
'ACE_OS::getenv' not
allowed c:\tmp\ace+tao+ciao\ace_wrappers\ace\os_ns_stdlib. h 116
...
...
When i changed #include <string> to #include <string.h> i got no errors
concerning iosfwd but the rest don't go away.
The config.h of ACE contains the following line:
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#include "ace/config-win32.h"
The version of ACE is Release,v 4.13 2005/08/05

It can be compiled on Linux/Unix and I suspect there is something wrong
with the installation of ACE. Does anyone has experienced the
same/similar problem before????

Apr 4 '06 #1
3 4623
I cleaned all the object files and rebuilt again and this time i got
different errors. The following code is the fragement of the whole
AmmUtils.h file and can anyone be kind to tell me what's wrong with my
code?

Error 13 error C2062: type 'int'
unexpected c:\working\qommessage\qommessage\ammutils.h 14
Error 14 error C2334: unexpected token(s) preceding '{'; skipping
apparent function body c:\working\qommessage\qommessage\ammutils.h 14
Error 15 error C2146: syntax error : missing ';' before identifier
'errMsg' c:\working\qommessage\qommessage\ammutils.h 31
Error 16 error C4430: missing type specifier - int assumed. Note: C++
does not support
default-int c:\working\qommessage\qommessage\ammutils.h 31
#ifndef __AMM_UTILS__
#define __AMM_UTILS__

#include <string>
#include <ace/Synch.h>
#include <tibrv/tibrvcpp.h>

//namespace AMM
//{

class AMMException
{
public:
AMMException(int pErrCode = 0, string pErrMsg = "")
{
mErrCode = pErrCode;
mErrMsg = pErrMsg;
}
virtual ~AMMException()
{
}
AMMException(const AMMException& that)
{
mErrCode = that.mErrCode;
mErrMsg = that.mErrMsg;
}
int errCode() const
{
return mErrCode;
}
string errMsg() const
{
return mErrMsg;
}

private:
int mErrCode;
string mErrMsg;
};
..
..
..
#endif

Apr 4 '06 #2
ma*************@hotmail.com wrote:
I cleaned all the object files and rebuilt again and this time i got
different errors. The following code is the fragement of the whole
AmmUtils.h file and can anyone be kind to tell me what's wrong with my
code?

Error 13 error C2062: type 'int'
unexpected c:\working\qommessage\qommessage\ammutils.h 14
Error 14 error C2334: unexpected token(s) preceding '{'; skipping
apparent function body c:\working\qommessage\qommessage\ammutils.h 14
Error 15 error C2146: syntax error : missing ';' before identifier
'errMsg' c:\working\qommessage\qommessage\ammutils.h 31
Error 16 error C4430: missing type specifier - int assumed. Note: C++
does not support
default-int c:\working\qommessage\qommessage\ammutils.h 31
#ifndef __AMM_UTILS__
#define __AMM_UTILS__

#include <string>
#include <ace/Synch.h>
#include <tibrv/tibrvcpp.h>

//namespace AMM
//{

class AMMException
{
public:
AMMException(int pErrCode = 0, string pErrMsg = "")
{
mErrCode = pErrCode;
mErrMsg = pErrMsg;
}
virtual ~AMMException()
{
}
AMMException(const AMMException& that)
{
mErrCode = that.mErrCode;
mErrMsg = that.mErrMsg;
}
int errCode() const
{
return mErrCode;
}
string errMsg() const
{
return mErrMsg;
}

private:
int mErrCode;
string mErrMsg;
};
.
.
.
#endif


Methinks you are probably lacking namespace qualification of
std::string (unless one of those other headers nastily puts a using
declaration in the header). Change each appearance of string to
std::string, or make a private alias, e.g.:

class A
{
typedef std::string string;
public:
A( const string& s );
};

Cheers! --M

Apr 4 '06 #3
ma*************@hotmail.com wrote:
Compiling a program using ACE + MSVC++8, got lots of errors and some
are listed as below:

Error 2 error C2894: templates cannot be declared to have 'C'
linkage c:\program files\microsoft visual studio
8\vc\include\iosfwd 39
Error 39 error C2733: second C linkage of overloaded function
'ACE_OS::atoi' not
allowed c:\tmp\ace+tao+ciao\ace_wrappers\ace\os_ns_stdlib. h 79
Error 41 error C2733: second C linkage of overloaded function
'ACE_OS::getenv' not
allowed c:\tmp\ace+tao+ciao\ace_wrappers\ace\os_ns_stdlib. h 116
..
..
When i changed #include <string> to #include <string.h> i got no errors
concerning iosfwd but the rest don't go away.
The config.h of ACE contains the following line:
#define ACE_HAS_STANDARD_CPP_LIBRARY 1
#include "ace/config-win32.h"
The version of ACE is Release,v 4.13 2005/08/05

It can be compiled on Linux/Unix and I suspect there is something wrong
with the installation of ACE. Does anyone has experienced the
same/similar problem before????


If the ACE headers are '*.h' instead of '*.hpp', you may have to
tell MSVC that they are C++ files (via the -Tp compiler switch if
I remember correctly). The error message seems to suggest that MSVC thinks
everything is 'C' instead of C++.

You might get more info help in an MSVC newsgroup.

Regards,
Larry
Apr 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: qazmlp | last post by:
const has internal linkage in C++, but external linkage in C. Am I right ? But, linker reports multiply-defined error if the following header is included in multiple .cpp files. //...
4
by: Nimmi Srivastav | last post by:
Once and for all can someone kindly tell me the difference between C and C++ linkage. I thought I understood it till someone showed me the other day that C functions, that would ordinarily require...
47
by: Richard Hayden | last post by:
Hi, I have the following code: /******************************** file1.c #include <iostream> extern void dummy(); inline int testfunc() {
20
by: Grumble | last post by:
Hello everyone, As far as I understand, the 'inline' keyword is a hint for the compiler to consider the function in question as a candidate for inlining, yes? What happens when a function with...
10
by: Mark A. Gibbs | last post by:
I have a question about mixing C and C++. In a C++ translation unit, I want to define a function with internal linkage and C calling convention. Here's a sample of what I want to do: //...
5
by: pembed2003 | last post by:
Hi all, I am reading the book "C How to Program" and in the chapter where it discuss scope rule, it says there are four scopes for a variable: function scope file scope block scope...
3
by: al.cpwn | last post by:
do static and inline functions or members have internal linkage? I have been reading this newsgroup on google and found conflicting ideas. Can someone please help me understand why in some places...
13
by: fctk | last post by:
source: http://rm-f.net/~orange/devel/specifications/c89-draft.html#3.1.2.2 there are two passages in this paragraph i can't fully understand: 1) "If the declaration of an identifier for an...
12
by: Taras_96 | last post by:
Hi everyone, AFAIK external linkage allows you to refer to variables/functions outside of the current translation unit. A variable in an unnamed namespace is similar to declaring a static...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.