Can I compile in VC2008 with a makefile?

A

Anna Smidt

After having programmed since 8 years only VB6 I want to learn C++.NET now.
It's amazing that everything has to be prepared first. For example I
want to build the DirectShow baseclass, but the only files I found in
the PSDK\Samples\Multimedia\DirectShow\BaseClasses are

..cpp
..h
makefile

I would like to ask how I should compile them because I was thinking
that I would have a .sln file. Or can I use the makefile somehow in
VC++2008.NET. Btw, when talking about VC++2008, should I say VC9?
 
A

Anna Smidt

I don't understand why you nobody replies. You could even say "It's a
too complicated theme" or "Learn basics first"... just any reply would
be good.
Anna
 
S

SvenC

Hi Anna,
After having programmed since 8 years only VB6 I want to learn
C++.NET now. It's amazing that everything has to be prepared first.
For example I
want to build the DirectShow baseclass, but the only files I found in
the PSDK\Samples\Multimedia\DirectShow\BaseClasses are

.cpp
.h
makefile

I would like to ask how I should compile them because I was thinking
that I would have a .sln file. Or can I use the makefile somehow in
VC++2008.NET.

In the program group of Visual Studio you should find a Tools sub
group with a "Visual Studio 2008 command prompt". Alternatively
the Platform SDK has a "CMD prompt". Start either of those, set
the current directory to the sample you want to build and use
nmake -f makefile

sln files should be available in samples of MFC and ATL.
Btw, when talking about VC++2008, should I say VC9?

Yes.
 
A

Anna Smidt

nmakeworks great with your explanation/ tutorial (thanks again!), but
why does it produce debug files under WIN2000_DEBUG? I thought that "-f"
would make it build release files. When a file has "d" on the end (like
strmbasD.lib) then it's a debug file, right?
I have learnt that the makefile is a macro. In the makefile I can read

!IFDEF NODEBUG
STRMBASE=strmbase
!else
STRMBASE=strmbasd
!endif

I thought that by saying -f I would set NODEBUG to "TRUE" (which would
be RELEASE, wouldn't it?)

Anna
 
A

Anna Smidt

HHAHHAHAHHAHAHA my first success in C++.
I found out that I have to append NODEBUG=1
So it's nmake -f makefile NODEBUG=1

:))) So happy
 
S

SvenC

Hi Anna,
HHAHHAHAHHAHAHA my first success in C++.
I found out that I have to append NODEBUG=1
So it's nmake -f makefile NODEBUG=1

:))) So happy

Good to see you found it yourself.
-f or /f is just the option to the specify the *f*ile to make.

Use nmake /? to get help on nmake's options.

Google for "site:msdn.microsoft.com nmake" (without quotation
marks) to get some information about nmake from msdn library.
 
A

Anna Smidt

After my first "yippies" I am a bit downside. Could it be that we C++
programmers spend about 50% of our time compiling something? I don't
want to be sarcastic, I would only like to know what I have to expect. I
am trying to compile OpenCV (an image library) for several hours now,
and I have to fetch all the hints about how to do it from Google without
any success yet. Everytime I have managed to attach the correct
libraries and include and source files to my IDE, another problem pops up.
Could anybody tell me after how many weeks this stress will be gone or
feel normal?

Anna
 
S

SvenC

Hi Anna,
After my first "yippies" I am a bit downside. Could it be that we C++
programmers spend about 50% of our time compiling something? I don't
want to be sarcastic, I would only like to know what I have to
expect. I am trying to compile OpenCV (an image library) for several
hours now,
and I have to fetch all the hints about how to do it from Google
without any success yet. Everytime I have managed to attach the
correct libraries and include and source files to my IDE, another
problem pops up. Could anybody tell me after how many weeks this
stress will be gone or feel normal?

That depends all on the libraries, their documentation and their platform
and compiler support.

When I took some parts of the boost library back while using with VC6
and VC7 they included working makefiles and I had no problems.

When you use the libraries and samples coming with VC9 you should
also have no problems.

So you might be having bad luck with your library.

Did you find this link already?
http://opencvlibrary.sourceforge.net/wiki-static/VisualC(2b2b).html
 
A

Anna Smidt

Sven,
thanks, you're really nice. I know this link.
I don't have any problems running an OpenCV application, but there is a
bug in the OpenCV libraries themselves. I want to fix it and then
rebuild it. Maybe it's easy, but at 4 in the morning I gave up :)
I will try it again now.
Anna
 
S

SvenC

Hi Anna,
thanks, you're really nice. I know this link.
I don't have any problems running an OpenCV application, but there is
a bug in the OpenCV libraries themselves. I want to fix it and then
rebuild it. Maybe it's easy, but at 4 in the morning I gave up :)
I will try it again now.

Sometimes a break is quite helpful ;-)

Just come back with source and compiler errors if you can't find out
yourself what's wrong. There are quite some helpful eyes around here.
 
G

Granville Barnett

SvenC said:
Hi Anna,


Sometimes a break is quite helpful ;-)

Just come back with source and compiler errors if you can't find out
yourself what's wrong. There are quite some helpful eyes around here.

I would definatley give their build instructions a close read, sometimes you
may have to set some env variables manually as well (I know...).

Let us know how you get on.

Granville
 
A

Anna Smidt

Hi Sven,

it's all going well :) I'm really happy! At least there is nothing that
really blocks me from going on.

I have a question:

I have this class:

class asmmovieavi
{
public:
asmmovieavi(): capimg(0), capture(0), image(0){ }
~asmmovieavi(){Close();}

// Open a AVI file
void Open(const char* videofile);

//capture from live camera
void CaptureCamera();

// Close it
void Close();

// Get concrete frame of the video
// Notice: for speed up you have no need to release the returned image
IplImage* ReadFrame(int frame_no = -2);

// frame count of this video
const int FrameCount()const
{return (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);}

const int Type()const{ return avi_or_cam; }

private:
IplImage* capimg;//captured from video
IplImage *image;
CvCapture* capture;
int avi_or_cam; //0:avi, 1:cam

};

I think it's a beginner's misunderstanding, but I don't see where const
char* videofile goes. I mean to me it looks as if the class doesn't
really do anything with "videofile". I thought that void Open was a
public void that I one can call when he has a handle to the class. At
least I am calling this void in another part of my code, so I'm
wondering what it does.
Even more strange to me is "void Close()". It seems to be hanging around
in there doing nothing.

Thanks again a lot.
Anna
 
B

Ben Voigt [C++ MVP]

Anna said:
Hi Sven,

it's all going well :) I'm really happy! At least there is nothing
that really blocks me from going on.

I have a question:

I have this class:

class asmmovieavi
{
public:
asmmovieavi(): capimg(0), capture(0), image(0){ }
~asmmovieavi(){Close();}

// Open a AVI file
void Open(const char* videofile);

//capture from live camera
void CaptureCamera();

// Close it
void Close();

// Get concrete frame of the video
// Notice: for speed up you have no need to release the returned image
IplImage* ReadFrame(int frame_no = -2);

// frame count of this video
const int FrameCount()const
{return (int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);}

const int Type()const{ return avi_or_cam; }

private:
IplImage* capimg;//captured from video
IplImage *image;
CvCapture* capture;
int avi_or_cam; //0:avi, 1:cam

};

I think it's a beginner's misunderstanding, but I don't see where
const char* videofile goes. I mean to me it looks as if the class
doesn't really do anything with "videofile". I thought that void Open
was a public void that I one can call when he has a handle to the
class. At least I am calling this void in another part of my code, so
I'm wondering what it does.
Even more strange to me is "void Close()". It seems to be hanging
around in there doing nothing.

This is a totally new question, you should have started a new thread with an
appropriate subject line.

To answer your question, the lines you show are prototypes aka forward
declarations. The actual code implementing these functions is elsewhere.
This separation of interface and implementation is something that many other
C-syntax languages (Java, C#, etc) do not allow.
 

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

Top