order in which files are built

P

p_adib

hello.
I have 3 files:
parent.cpp
child.cpp
driver.cpp

I am working in visual C++ 6.0 and have all the files in one same
project. When I ask the IDE to biuld my project, it compiles the code
in such a way that the order makes it incorrect. For example, it
compiles the parent.cpp file after child.cpp . Any ideas on how to
specify a building order? I know that eclipse does this automatically
for java, but what about for visual studio C++?

Thanks for your heads up.
 
P

Phlip

p_adib said:
I have 3 files:
parent.cpp
child.cpp
driver.cpp

I am working in visual C++ 6.0 and have all the files in one same
project. When I ask the IDE to biuld my project, it compiles the code
in such a way that the order makes it incorrect. For example, it
compiles the parent.cpp file after child.cpp . Any ideas on how to
specify a building order? I know that eclipse does this automatically
for java, but what about for visual studio C++?

..cpp files can compile in any order. Their order can never be incorrect.

They may, upon rare occassion, link in the wrong order. You probably don't
have that problem.

You need to report the actual problem you have, before thinking the build
order will fix this problem. If, for example, you have missing identifiers,
then you might have incomplete .h files.

Next, you must understand this newsgroup is only qualified to discuss raw
C++ itself, not all its compilers or their options. If you have a problem
that any C++ developer could help you with, post it here. If your problem
appears to come from VC++, try instead.
 
S

Salt_Peter

hello.
I have 3 files:
parent.cpp
child.cpp
driver.cpp

I am working in visual C++ 6.0 and have all the files in one same
project. When I ask the IDE to biuld my project, it compiles the code
in such a way that the order makes it incorrect. For example, it
compiles the parent.cpp file after child.cpp . Any ideas on how to
specify a building order? I know that eclipse does this automatically
for java, but what about for visual studio C++?

Thanks for your heads up.

Building order should not affect the initialisation of your objects. If
it does, you have undefined behaviour. Since you aren't describing the
objects that are causing this, we can't help.

See if the following describes your issue:
How do I prevent the "static initialization order fiasco"?
http://www.parashift.com/c++-faq-lite/ctors.html
#faq-10.12
 
P

p_adib

Phlip said:
.cpp files can compile in any order. Their order can never be incorrect.

Well, I talked to my professor and it was a syntax error. When I fixed
it, the program compiled and I understand now that compile order is not
an issue.
They may, upon rare occassion, link in the wrong order. You probably don't
have that problem.

Ok, I guess I'll take a look at the link that Salty_Peter sent me ( How
do I prevent the "static initialization order fiasco"? ) for more on
it.
Next, you must understand this newsgroup is only qualified to discuss raw
C++ itself, not all its compilers or their options. If you have a problem
that any C++ developer could help you with, post it here. If your problem
appears to come from VC++, try news:microsoft.public.vc.language instead.

Thanks, but I have no confusion regarding this. I was only stating my
environment so that you could understand the context of the issue,
which I deemed a C++ one and not a VC++ one. Though I appreciate you
setting the record straight and will be carefull to post things at
their appropriate place.

Phil.
 
P

Phlip

p_adib said:
Thanks, but I have no confusion regarding this. I was only stating my
environment so that you could understand the context of the issue,
which I deemed a C++ one and not a VC++ one. Though I appreciate you
setting the record straight and will be carefull to post things at
their appropriate place.

The exact hair to split (unless you post code with a syntax error in it for
us to review) is that only someone familiar with the VC++ environment can
tell you how to change the order it will compile its input files.

Always state your compiler anyway, because you might indeed have a
compiler-specific bug. The admonition is not against stating your compiler's
name, it is against asking a generic group how to configure a specific
compiler correctly.

Try to answer questions here for a while, and you will see what I mean!
 
P

p_adib

Phlip wrote:
The admonition is not against stating your compiler's
name, it is against asking a generic group how to configure a specific
compiler correctly.

Thank you Phlip for helping me discern this issue.
 
P

p_adib

Phlip said:
The admonition is not against stating your compiler's
name, it is against asking a generic group how to configure a specific
compiler correctly.

Thank you Phlip for helping me discern this issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top