Getting started with MS Visual Studio C++

J

jgh

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

How do I actually build the bugger? I've gone through every menu
and can't find anything along the lines of Build, Compile, Make,
whatever. I've tried dragging the main.cpp file into the IDE to
see if any extra options appear... no. I've tried dragging
Makefile into the IDE... nope.

I've spent about an hour going through the documentation, but
absolutely everything assumes you're starting from scratch
writing something new. Absolutely nothing about how to build
a pre-existing set of source file.

I'm now off to make a cup of tea...

JGH
 
N

Noob

jgh said:
I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

Errr, first of all, comp.lang.c deals with C not C++
and it deals with the language itself, not specific tools.

If you need help with some specific (proprietary) tool,
you'll have to find the proper forum.

Perhaps one of these?
http://support.microsoft.com/ph/1117
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio
http://msdn.microsoft.com/en-us/vstudio/dn439939

Regards.
 
K

Ken Brody

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

How do I actually build the bugger? I've gone through every menu
and can't find anything along the lines of Build, Compile, Make,
whatever. I've tried dragging the main.cpp file into the IDE to
see if any extra options appear... no. I've tried dragging
Makefile into the IDE... nope.
[...]

Assuming you have a Visual Studio compatible makefile:

File / New / Project / Visual C++ / General / Makefile project.

Or, given the above-mentioned VS-compatible makefile, simply type this from
the command prompt:

nmake /f name_of_makefile

(There should be instructions as comments at the top of that makefile.)

If they didn't include a VS-compatible makefile, you're SOL, and you'll need
to start a project from scratch.

For more information, you'll need to ask in a Microsoft-specific newsgroup.
 
M

Malcolm McLean

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?


I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.
You have to fight it. A hour's fiddling is nothing when it comes to
Microsoft products. Things are constantly breaking. The interface for declaring
a Window class changes from char * to unicode for the class name, and so every
single file needs a little cast adding to it. Then makes and projects almost
certainly won't carry from one version to the next.
However the basic C++ logic should still be fine. As long as you keep
Microsoft dependencies out of your core logic functions, there's very little
they do to that. You do get a bunch of warnings for every call to a C string
function, but they can be ignored.

So create a hello world project, and get that working. Then copy files one by
one to the folder (directory) where "hello.c" appeared, and add them one by one
to the project. Or if it won't have it, create new files, then cut and paste.
Sometimes it likes to add stdfx.h to everything, and won't compile without it.
This is infuriating. Either add it, or fight and fight again until it drops
he demand (create different hello worlds with different settings until
stdafx disappears).
 
L

Les Cargill

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

How do I actually build the bugger? I've gone through every menu
and can't find anything along the lines of Build, Compile, Make,
whatever. I've tried dragging the main.cpp file into the IDE to
see if any extra options appear... no. I've tried dragging
Makefile into the IDE... nope.

I've spent about an hour going through the documentation, but
absolutely everything assumes you're starting from scratch
writing something new. Absolutely nothing about how to build
a pre-existing set of source file.

I'm now off to make a cup of tea...

JGH

Hey, just contact M$ support! I'm sure they'll gladly help you!

("Here, let me laugh even harder" - Bender) :)

Just don't use Studio unless you absolutely have to. Don't use *ANY* IDE
that enforces specific use cases for development.

IOW, don't use any IDE. If you don't think IDEs are a bad idea, you
have not thought the problem all the way through.
 
J

J. Clarke

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

How do I actually build the bugger? I've gone through every menu
and can't find anything along the lines of Build, Compile, Make,
whatever. I've tried dragging the main.cpp file into the IDE to
see if any extra options appear... no. I've tried dragging
Makefile into the IDE... nope.

I've spent about an hour going through the documentation, but
absolutely everything assumes you're starting from scratch
writing something new. Absolutely nothing about how to build
a pre-existing set of source file.

I'm now off to make a cup of tea...

JGH

To answer your immediate question, the F7 key should start the build.
However you should also have "build" right next to "debug" in the menu
bar at the top if you're in the right place.

You _have_ to have a project open though in order to compile. There
should be an option "blank project" that lets you import your code from
the "solution explorer" window (right click on the "source folder" and
"add existing code" once the project is open). There may be one
"project from existing code" (that's available in 2010, I don't have
2008 installed anymore) or "makefile project" (that one is in 2013, but
I don't see it in 2010).
 
G

Geoff

I'm banging my head on a wall here, and have probably missed
something completely obvious. How do I actually compile
pre-existing code with MS Visual Studio C++ ?

I've registered a hobbiest licence for MS Visual Studio C++ 2008.
I have a collection of *.cpp and *.h files and a Makefile for a
pre-existing application.

How do I actually build the bugger? I've gone through every menu
and can't find anything along the lines of Build, Compile, Make,
whatever. I've tried dragging the main.cpp file into the IDE to
see if any extra options appear... no. I've tried dragging
Makefile into the IDE... nope.

I've spent about an hour going through the documentation, but
absolutely everything assumes you're starting from scratch
writing something new. Absolutely nothing about how to build
a pre-existing set of source file.

I'm now off to make a cup of tea...

JGH

Off topic for this group but the answer to your question is that you
must create a solution. A solution is a project or collection of
projects. If the project is old code from VS 6.0 or an older version
of VS you simply double click the .dsp or .dsw file in the folder, VS
2008 will invoke a conversion process and lead you through
establishing the new project. Warning: VS2008 is somewhat broken in
this regard. Later versions like 2013 are better.

If the project isn't already a VS project you must create a new one.

You start a new solution by clicking File | New...

You now have two choices, A new project, (ctrl-shift-N) or new project
from existing code. If you create a new project, you must then add the
source files to it manually but the wizard will walk you through
creating a project of the proper type if you know what type you
need... Note: do not click "Finish" until you have absolutely no other
choice in the wizard. Clicking "Finish" too soon may create a project
of a type you didn't intend.

If you create a project via the "existing code" option, the wizard
will take you through selecting the folder containing your files and
the name and type of your project. Again, know what type of project
you intend before walking down the road of "Next".
 

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

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top