473,386 Members | 1,754 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,386 software developers and data experts.

Help on the order of #includes in C++

Hello,

I am having a problem with the order of the #includes in C++. When I
compile it in VC++ 6.0 it gives me no problems, but when I try it out in
VS.NET, it gives me a redefinition error:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdlib.h(251):
error C2381: 'exit' : redefinition; __declspec(noreturn) differs

So I tried different orders of the includes, but no matter if I include the
<windows.h> first or the <stdlib.h> first, it always complains. Please note
that this is not my code, but I am supposed to use it as "helpful" template
code. Can anyone shed some light on the subject???

Thanks. See below for my #includes.

--
Regards,
Webster

Original Code:
---------------
#ifdef WIN32
#include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>

#include <iostream.h>

The way I currently have:
--------------------------
#ifdef WIN32
#include <windows.h>
#endif

//#include <iostream.h>
//#include <stdio.h>
//#include <math.h>
//#include <stdlib.h> <--- commented this out because i suspected that
the <windows.h> file should have defined exit

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

Nov 16 '05 #1
2 4818
I am not sure that i can solve your problem, but i have had problems with
standard include files.
It turned out that i did not need to put '.h' in the name of the include
file:

use
#include <string>
instead of
#include <string.h>

but as i said i don't know if this is the cause of your problem.

kind regards,
Bruno.
"Webster" <no***@nowhere.com> wrote in message
news:qF*********************@news01.bloor.is.net.c able.rogers.com...
Hello,

I am having a problem with the order of the #includes in C++. When I
compile it in VC++ 6.0 it gives me no problems, but when I try it out in
VS.NET, it gives me a redefinition error:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdlib.h(251):
error C2381: 'exit' : redefinition; __declspec(noreturn) differs

So I tried different orders of the includes, but no matter if I include the <windows.h> first or the <stdlib.h> first, it always complains. Please note that this is not my code, but I am supposed to use it as "helpful" template code. Can anyone shed some light on the subject???

Thanks. See below for my #includes.

--
Regards,
Webster

Original Code:
---------------
#ifdef WIN32
#include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>

#include <iostream.h>

The way I currently have:
--------------------------
#ifdef WIN32
#include <windows.h>
#endif

//#include <iostream.h>
//#include <stdio.h>
//#include <math.h>
//#include <stdlib.h> <--- commented this out because i suspected that
the <windows.h> file should have defined exit

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>


Nov 16 '05 #2
Thanks for the help.. but this unfortunately does not solve the problem...
:o(

--
Regards,
g1shaf
"Bruno van Dooren" <mi******@hotmail.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
I am not sure that i can solve your problem, but i have had problems with
standard include files.
It turned out that i did not need to put '.h' in the name of the include
file:

use
#include <string>
instead of
#include <string.h>

but as i said i don't know if this is the cause of your problem.

kind regards,
Bruno.
"Webster" <no***@nowhere.com> wrote in message
news:qF*********************@news01.bloor.is.net.c able.rogers.com...
Hello,

I am having a problem with the order of the #includes in C++. When I
compile it in VC++ 6.0 it gives me no problems, but when I try it out in
VS.NET, it gives me a redefinition error:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\stdlib.h(251):
error C2381: 'exit' : redefinition; __declspec(noreturn) differs

So I tried different orders of the includes, but no matter if I include

the
<windows.h> first or the <stdlib.h> first, it always complains. Please

note
that this is not my code, but I am supposed to use it as "helpful"

template
code. Can anyone shed some light on the subject???

Thanks. See below for my #includes.

--
Regards,
Webster

Original Code:
---------------
#ifdef WIN32
#include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>

#include <iostream.h>

The way I currently have:
--------------------------
#ifdef WIN32
#include <windows.h>
#endif

//#include <iostream.h>
//#include <stdio.h>
//#include <math.h>
//#include <stdlib.h> <--- commented this out because i suspected that the <windows.h> file should have defined exit

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>



Nov 16 '05 #3

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

Similar topics

1
by: developerqs | last post by:
I have developed an engine that I use for all of my clients web sites. They are all the same type of site, some use features A, B, & C. Some web sites just use features A & B. My issue is that...
8
by: Jason | last post by:
I have a table that matches up Securities and Exchanges. Individual securities can belong on multiple exchanges. One of the columns, named PrimaryExchangeFlag, indicates if a particular exchange is...
10
by: Chris Gordon-Smith | last post by:
I am currently revisiting the code of a C++ application and restructuring the code where appropriate to make it consistent with the overall logical design. As part of this, I am looking at the...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
8
by: Adam Greifer | last post by:
Hi! I'm a newbie at DB2 but have 13 years of SQL Server. I need to convert over 100 SQL Server procs to DB2. I haven't had much luck with the IBM Integration Toolkit and want to avoid ER/win...
1
by: treelife | last post by:
I'm getting and internal server error when | run the following mod_python script. I am actually trying to run Django. Script: from mod_python import apache def handler(req):...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
2
by: NITHYA LATHA | last post by:
XYZ Company is a Car production company. It has four factories and many distribution outlets spread across the country. The company keeps online records of the sales of its cars. It also creates...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...
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...

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.