473,324 Members | 2,313 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,324 software developers and data experts.

Creating a make file for a c++ project

105 100+
hi all,

I have a c++ project and would like to create a make file.

say my main program is a.cpp and other source file associated with this project is b.bpp and its header file b.h.There are different lib files also used to execute this program.

Could anyone please give me an idea of how to start creating it and how to execute a c++ project using make file on windows??

Thanks.
May 1 '07 #1
9 3413
weaknessforcats
9,208 Expert Mod 8TB
Are you using Visual Studio??

If so, the make file is generated when you select Build and deleted when the build is complete. Your source files are part of your program if they are part of your project.

Make files are different between Unix and Windows so if you want to write one from scratch you will need to get the approppriate book.
May 1 '07 #2
vermarajeev
180 100+
hi all,

I have a c++ project and would like to create a make file.

say my main program is a.cpp and other source file associated with this project is b.bpp and its header file b.h.There are different lib files also used to execute this program.

Could anyone please give me an idea of how to start creating it and how to execute a c++ project using make file on windows??

Thanks.
Well,
If you are aware about Qt (GUI tool) your work will be very easy. There is a tool provided by Qt which helps you create a Makefile. This tool is called qmake. You just need to create a pro file and then say qmake test.pro. This creates a makefile.
I suggest you to use qmake.
But if you are not interested in Qt then too creating Makefile is not a big deal. Just refer to this link http://mrbook.org/tutorials/make/ .

But I suggest you to first see this link about Qt..http://www.qtcentre.org/ . You will love it.

Thanks
May 1 '07 #3
Banfa
9,065 Expert Mod 8TB
If all you want to do is make you programs form the command line then there is no need for make files. you can call msdev.exe (the MSVC++ IDE exe name) with the workspace and project to build from the command line.

Or at least you could in MSVC++ 6.0 not to sure about later versions but you'd hope they didn't get rid of that feature.
May 1 '07 #4
mickey22
105 100+
Thank you all for the information.

I have a sample make file and need to build my program in clearcase.Thats what I am trying to do.

I have small question.Usually the code is built in debug and release modes.I guess the library files used during linking for debug and release modes are different.So in the sample make file, there is STATIC LIBS (list of lib files).

When I am building my project in clearcase, am I building it in debug or release mode or in both and dont I have to include lib files for both debug and release.How does that work??Please let me know if I am not clear with my question?

Could anyone please explain me this concept?

Thanks a lot in advance.
May 2 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
A debug build has embedded code to allow you to use the debugger. Therefore, the executable is much larger than necessary. Usually a debug build is the default. Along with build, all libraries must also be debug libraries. With a tool there is usually a project setting that specifies debug or release.

A release build just doesn't have the debug support code in the executable. You will have release libraries for this type of build. If you get a problem with a release build, you can't debug it.

A debug library will have a different name from a release library or they will have the same name but the tool will separate them into separate folders.
May 2 '07 #6
mickey22
105 100+
Sorry I am still not clear.What libraries(debug or release) should I provide in the make file when I build my program in clear case?

I have tested my program with release libraries in my local directory and it is working.
In my make file there is only set of LIB's.To which do they refer?My program generates an executable file.

Thanks.
May 2 '07 #7
weaknessforcats
9,208 Expert Mod 8TB
ClearCase is a version control system. You would install ClearCase and then use it with, say, Visual Studio.NET 2005. The debug/release settings would be part of the Visual Studio project. If you set for debug, then set a property for the linker to include your libraries. There is a secoind property to set the path top those debug libraries. If you set for release, then set a path to your release libraries.

What IDE are you using?
May 2 '07 #8
mickey22
105 100+
Clear case is installed and I am using Visual C++ 2005.I was able to create a make file and able to build it in release mode.When I use the same make file with the same include paths and lib files, it generates executable file in debug version, but exception as
"Unable to locate some .dll"

As I have posted separately also (sorry if I am repeating it) , I tried to run my program in debug mode with samelib files as in release mode in my local director.I got theses linking errors.


LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>LIBCMT.lib(invarg.obj) : error LNK2005: ___pInvalidArgHandler already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __get_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invoke_watson(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invoke_watson@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>LIBCMT.lib(invarg.obj) : error LNK2005: "void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)" (?_invalid_parameter@@YAXPBG00II@Z) already defined in LIBCMTD.lib(invarg.obj)
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library


When i used different lib files I got these warnings

LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance

Sorry If I am creating confusion.Its just I am little bit new and just trying to learn all theses things.I really appreciate and thank you for helping me .

Please let me know if I am not clear.


Thanks.
May 3 '07 #9
mickey22
105 100+
The make file that has been created generates the teargets in debug and release modes and lib files needed for debug as well as release mode are taken care by the paths given in the make file automatically.

Thats solved my issue.

Thank you all once again.
May 4 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: dave | last post by:
I first started using HCW.exe to compile .rtf filew created with MS Word a couple of weeks ago. I used the file | new menu then selected New project in the dialog box and everything worked as...
7
by: Simon Edwards | last post by:
Something thats been bugging me for a while... how do you create a namespace that has many children (namespaces) I.e system.io.blah.blah Iv'e done it by creating a class which contains...
3
by: dave | last post by:
I am using vs.net 2003 on windows xp. After clicking on a project within my solution and selecting create new folder vs.net responds back with , the "directory already exists". If i look at the...
2
by: jcooper | last post by:
Hi all, I'm new to VB.net and have a question about creating the .exe file for my program. In VB6 you could just select 'Make .exe' from the File menu, but everything that I read about...
2
by: Brad Wood | last post by:
Using VS2003, I can't add an existing class to a project w/o the IDE creating a copy of it. I want multiple projects to be able to share a central copy of a class. I can't compile the shared...
2
by: George Marsaglia | last post by:
I have a set of, say, 2000 points in the 8-dimensional simplex S={(x_1,x_2,...,x_8),x_1+x_2+...+x_8=1, x's>=0}. To help analyze that 8-dimensional set, I wish to project the set of points onto...
15
by: Carlos Lozano | last post by:
Hi, What is the right way to create an OCX COM component. The component is already registerred, but can't create an instance. I am using the reference to the interop module created. If I use...
4
by: Bob | last post by:
Could anyone suggest me some examples/articles on creating a setup program in VS.NET that can install the assembly into the GAC? I have done some search and research myself and have some basic...
2
by: Val3 | last post by:
Hi all. I need to build dll(s) and windows services using VB .NET 2005 Express. When I make File/New project the windows contain only Windows application, Windows control library, Console...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.