473,626 Members | 3,467 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ANSI C to VC++ 2008

I'm not too much of a C++ programmer but I have a bunch of C programs
(they compile with GNU) and want to get them to compile in VC++ 2008.

In Unix I go "./configure" and it makes a "Makefile". I then do
"make" and when thats done I do "make install".

Is there some way to easily get this type of project working in VC++
2008? I do "New Project From Exsisting Code Use VIsual Studio:
Console application". And I give it the Include folder that comes
with the program.

When I try to compile I get about 75 errors. Mostly all are
duplicates but is there some kind of switch I should be setting so
that VC++ 2008 will compile ANSI C source?
50% of the errors are these:

error C2054: expected '(' to follow 'inline'
error C2085: 'imax' : not in formal parameter listError
error C2143: syntax error : missing ';' before '{'

The 3 errors point to the same inline function which is (the project
uses about 10 of these functions all getting the same errors)

static inline int imax(int a, int b) {
return a b ? a : b;
}

and its found in a header file. Anyone know how I fix this? Or would
need more information?

Note: The project basically compiles two DLL files in a src folder and
then compiles a EXE in the examples folders (which links the 2
DLL's). There is only about 300KBs of source files.

I also see a "Makefile project" in VC++ 2008, but I don't know how to
use this, or if it'd even be usefull for me?

Basically if any one has any pointers a general outline on how I can
get C ANSI to compile in VC++ 2008 I'd be very greatful :)

Thanks, NB
Feb 29 '08 #1
2 2617
NvrBst wrote:
I'm not too much of a C++ programmer but I have a bunch of C programs
(they compile with GNU) and want to get them to compile in VC++ 2008.

In Unix I go "./configure" and it makes a "Makefile". I then do
"make" and when thats done I do "make install".

Is there some way to easily get this type of project working in VC++
2008? I do "New Project From Exsisting Code Use VIsual Studio:
Console application". And I give it the Include folder that comes
with the program.

When I try to compile I get about 75 errors. Mostly all are
duplicates but is there some kind of switch I should be setting so
that VC++ 2008 will compile ANSI C source?
50% of the errors are these:

error C2054: expected '(' to follow 'inline'
error C2085: 'imax' : not in formal parameter listError
error C2143: syntax error : missing ';' before '{'

The 3 errors point to the same inline function which is (the project
uses about 10 of these functions all getting the same errors)

static inline int imax(int a, int b) {
return a b ? a : b;
}
That's C99 code - VC++ does not support C99 (other than a few things, like
long long).
>
and its found in a header file. Anyone know how I fix this? Or would
need more information?
You'll need to modify the code to make it valid C89 or valid C++ 98. To
compile all the code as C++, rename the files .cpp instead of .c - that
could solve some of your problems, and/or create many more.
>
Note: The project basically compiles two DLL files in a src folder and
then compiles a EXE in the examples folders (which links the 2
DLL's). There is only about 300KBs of source files.

I also see a "Makefile project" in VC++ 2008, but I don't know how to
use this, or if it'd even be usefull for me?
It's not - ignore it.
>
Basically if any one has any pointers a general outline on how I can
get C ANSI to compile in VC++ 2008 I'd be very greatful :)
You're on the right track - it looks like it's just the lack of C99
compatibility that's tripping you up.

-cd
Feb 29 '08 #2
On Feb 28, 10:11*pm, "Carl Daniel [VC++ MVP]"
<cpdaniel_remov e_this_and_nos. ..@mvps.org.nos pamwrote:
NvrBst wrote:
I'm not too much of a C++ programmer but I have a bunch of C programs
(they compile with GNU) and want to get them to compile in VC++ 2008.
In Unix I go "./configure" and it makes a "Makefile". *I then do
"make" and when thats done I do "make install".
Is there some way to easily get this type of project working in VC++
2008? *I do "New Project From Exsisting Code Use VIsual Studio:
Console application". *And I give it the Include folder that comes
with the program.
When I try to compile I get about 75 errors. *Mostly all are
duplicates but is there some kind of switch I should be setting so
that VC++ 2008 will compile ANSI C source?
50% of the errors are these:
error C2054: expected '(' to follow 'inline'
error C2085: 'imax' : not in formal parameter listError
error C2143: syntax error : missing ';' before '{'
The 3 errors point to the same inline function which is (the project
uses about 10 of these functions all getting the same errors)
static inline int imax(int a, int b) {
* *return a b ? a : b;
}

That's C99 code - VC++ does not support C99 (other than a few things, like
long long).
and its found in a header file. *Anyone know how I fix this? *Or would
need more information?

You'll need to modify the code to make it valid C89 or valid C++ 98. *To
compile all the code as C++, rename the files .cpp instead of .c - that
could solve some of your problems, and/or create many more.
Note: The project basically compiles two DLL files in a src folder and
then compiles a EXE in the examples folders (which links the 2
DLL's). *There is only about 300KBs of source files.
I also see a "Makefile project" in VC++ 2008, but I don't know how to
use this, or if it'd even be usefull for me?

It's not - ignore it.
Basically if any one has any pointers a general outline on how I can
get C ANSI to compile in VC++ 2008 I'd be very greatful :)

You're on the right track - it looks like it's just the lack of C99
compatibility that's tripping you up.

-cd- Hide quoted text -

- Show quoted text -
Ahh thank you :) I changed them to cpp and then it complained about
no "stdbool.h" which I commented out and added my own "fmax(doubl e,
double)" function, and now it compiles :) I'll try some of the others
now :)

Thanks Again
Feb 29 '08 #3

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

Similar topics

143
8015
by: suri | last post by:
Hello I downloaded glibc and tried looking for the code that implements the sine function i couldnt find the file. i went to the math directory and found math.h.. i guess that needs to be included for the sine function. but which .c file implements the sine/cosine and other trig fns thanks
5
6492
by: mmxbass | last post by:
In Visual Studio 2005, how can I set my project to be a strict ANSI-C project with absoloutly nothing else? I don't want my project to even compile if it contains any C++ or non-ANSI code.
83
11587
by: sunny | last post by:
Hi All What is C99 Standard is all about. is it portable, i mean i saw -std=C99 option in GCC but there is no such thing in VC++.? which one is better ANSI C / C99? can i know the major difference between C99 & ANSI C standards?
7
8441
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then this installer will install them. But what about the situation where VC runtime has already been installed? In fact it's been installed twice. Although the project was built on a Windows XP system with Visual Studio 2005 SP1 and the results were...
53
2346
by: Edward Diener | last post by:
Why bother having Stan Lippman and Herb Sutter created a C++/CLI language for .Net development when Microsoft, and the VC++ development team, are so clearly intent on limiting .Net development with C++/CLI to the smallest subset of .Net development technologies in Visual Studio, while all of the new technologies are given to C# instead ? The bubble has burst with VS 2008 and we are instead finally told quite frankly, by a lead VC++ team...
0
1096
by: johntheys | last post by:
I am porting an old Borland C++ program to a VC++ 2008 CLR/Windows Form App. It has a home-grown script language used to set parameters, etc that can be modified by non-programmers. I would like to replace this script interpreter with an embedded python interpreter and change the script to python (I considered Ch but it is too costly). I'm new to both VC++ and python and I'm having trouble getting started. Does anyone have a trivial project...
2
1758
by: goo.one1 | last post by:
Hi All, I'm looking for info on how to port VC++ 6 code/projects to VC++ 9 (2008). I noticed that there is a converter built-in for Visual *BASIC* to convert from VS6 to 9... I have found the following brief note:
6
2633
by: Peng Yu | last post by:
Hi, ANSI and GNU C are different in some delicate aspects (I'm not sure about C++). For example, M_PI is not in ANSI C but in GNU C. Of course, to make my program most portable, I should go for ANSI. But since ANSI lacks some convenient facilities, such as M_PI just mentioned, I would like to use GNU C. Now, the question is if a platform has ANSI C, what is the chance it
2
1376
by: Peter Duniho | last post by:
On Fri, 18 Jul 2008 10:41:23 -0700, jmDesktop <needin4mation@gmail.com> wrote: Well, that's an interesting example, if for no other reason than that the DirectShow video capture stuff is a reasonably straight-forward and natural thing to access from .NET using the p/invoke stuff. You may be referring to the DirectShow.NET project, which I haven't used but understand to be a pretty good wrapper for DirectShow.
0
8268
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8641
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.