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

[VS 2005] Custom Build Step problem in C++

Hi all,

Sorry for the repost, but I never received any response when I first
asked this a few weeks ago. I would really appreciate some feedback on
this, it's driving me nuts...

I'm beginning the process of moving some projects from VS.Net 7 to
VS2005. I'm having problems getting a Custom Build Step to work.

In the dialog for the header file I want to perform the custom step on,
I copy and paste the command line:
$(QTDIR)\bin\moc.exe "..\Messenger.h" -o ".\moc_Messenger.cpp"

I also set description, outputs, additional dependencies
($(QTDIR)\bin\moc.exe), and click Ok. I can open the dialog up again,
and see all the options as I set them.

However, when I do a build, it fails, with moc.exe complaining of
invalid arguments. When I check the Command Line entry in the Custom
Build Step properties again, it now contains:
$(QTDIR)\bin\moc.exe -DQT_NO_DEBUG -D_WINDOWS -DUNICODE -DWIN32
-DQT_DLL -DQT_THREAD_SUPPORT -I"$(QTDIR)\include" -I"."
-I"d:\Qt\3.3.2\mkspecs\win32-msvc.net" "..\Messenger.h" -o
".\moc_Messenger.cpp".

I can remove the '-DQT_NO_DEBUG -D_WINDOWS -DUNICODE -DWIN32 -DQT_DLL
-DQT_THREAD_SUPPORT -I"$(QTDIR)\include" -I"."
-I"d:\Qt\3.3.2\mkspecs\win32-msvc.net', compile, get the error, repeat
ad naseum.

Is there some option somewhere in VS2005 that is causing it to add the
defines and includes to the command line for a CBS? I never experienced
this in VS 7.

Thanks, Michael
Sep 19 '06 #1
1 2336
Michael Russell wrote:
Hi all,

Sorry for the repost, but I never received any response when I first
asked this a few weeks ago. I would really appreciate some feedback
on this, it's driving me nuts...

I'm beginning the process of moving some projects from VS.Net 7 to
VS2005. I'm having problems getting a Custom Build Step to work.

In the dialog for the header file I want to perform the custom step
on, I copy and paste the command line:
$(QTDIR)\bin\moc.exe "..\Messenger.h" -o ".\moc_Messenger.cpp"

I also set description, outputs, additional dependencies
($(QTDIR)\bin\moc.exe), and click Ok. I can open the dialog up again,
and see all the options as I set them.

However, when I do a build, it fails, with moc.exe complaining of
invalid arguments. When I check the Command Line entry in the Custom
Build Step properties again, it now contains:
$(QTDIR)\bin\moc.exe -DQT_NO_DEBUG -D_WINDOWS -DUNICODE -DWIN32
-DQT_DLL -DQT_THREAD_SUPPORT -I"$(QTDIR)\include" -I"."
-I"d:\Qt\3.3.2\mkspecs\win32-msvc.net" "..\Messenger.h" -o
".\moc_Messenger.cpp".

I can remove the '-DQT_NO_DEBUG -D_WINDOWS -DUNICODE -DWIN32 -DQT_DLL
-DQT_THREAD_SUPPORT -I"$(QTDIR)\include" -I"."
-I"d:\Qt\3.3.2\mkspecs\win32-msvc.net', compile, get the error, repeat
ad naseum.

Is there some option somewhere in VS2005 that is causing it to add the
defines and includes to the command line for a CBS? I never
experienced this in VS 7.
I'm not aware of any switch - but I suspect that the problem lies in the
fact that .h is an extenion that the IDE recognizes, so it's "helping" you.
Would it be possible to use a different extension for this file - one that
the IDE doesn't know anything about?

You might want to look into the features in VC2005 that allow you to define
your own build tools (based on file extension) so you don't have to worry
about writing custom build steps. Finding the options in the help is rather
torturous, but...
In the solution explorer, right-click on your C++ project and choose "Custom
Build Rules..." from the context menu.
On the dialog that appears, click "New Rule File...".
Give your new rule file a name, like "Run MOC"

.... and so on. It's a bit more involved than one might hope (but it's also
pretty powerful). See

http://msdn2.microsoft.com/en-us/library/03t8bzzy.aspx

as a starting point.

-cd
Sep 20 '06 #2

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

Similar topics

3
by: Gordon Watts | last post by:
Hi there, I've got a special header file which I run an small external program over to produce a .cpp file that I want to have my project build. The special header file includes a second header...
2
by: Peter Ritchie | last post by:
In VS/VC 2003: Simple question: for the Custom Build Step for the project (right click the project in the Solution Explorer, select "Properties", select the "Custom Build Step" in the...
5
by: Steve Le Monnier | last post by:
I've just noticed that the menu items available in Visual Studio 2005 for the Debug and Build menus differ significantly when compared to the menu items in Visual Studio 2003. On my C#...
10
by: WT | last post by:
Hello, I have been publishing my web site many times to the remote where resides my final web site. Everything was ok, but to-day, without any configuration change, vs doesn't copy final files...
2
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. The only thing I did not understand in this article...
7
by: ashley.ward | last post by:
We have been using VB6 to develop small custom apps that access an Oracle database, in order to extend a larger product that is developed by our colleagues in Germany (who use C++ and Java). As...
10
by: Steve | last post by:
I am trying to create a DLL in Visual Studio 2005-Visual Basic that contains custom functions. I believe I need to use COM interop to allow VBA code in Excel 2002 to access it. I've studied...
0
by: Michael Russell | last post by:
Hi, I'm beginning the process of moving some projects from VS.Net 7 to VS2005. I'm having problems getting a Custom Build Step to work. In the dialog for the header file I want to perform the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.