Solved

Visual c++ problem with command line conflicts

Posted on 2015-02-04
22
188 Views
Last Modified: 2015-03-07
I am using Visual c++ 2013 community to write an MFC dialog based program.  I am at the point where I am introducing an MS common dialog for user support.  Now, it will not build, telling me that I need /clr support.
If I add /clr it complains that /clr and /MTd command line options are incompatible.  I am WAY beyond my expertise level when dealing with command line options.
0
Comment
Question by:Dave Shields
  • 7
  • 6
  • 4
  • +2
22 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 40588998
>>I am at the point where I am introducing an MS common dialog for user support.
You have added a .net based component (according to the clr requirement in the error message).  Remove that component and use one that is not .net based.

You can run MFC and .net together but it is rather complex.
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 250 total points
ID: 40589033
It seems that yourt dialog is .NET - so, first of all, do you actually want to integrate managed components into your C++ project? If so, you indeed need to use '/clr'. Maybe start out with https://msdn.microsoft.com/en-us/library/vstudio/ms173265%28v=vs.120%29.aspx ("How To: Migrate to /clr") and https://msdn.microsoft.com/en-us/subscriptions/administration/06s5xsah%28v=vs.90%29.aspx ("ScribbleDotNET Sample: Extending Scribble with CLR Features") which shows how to to include new .NET functionality in your project.

And, to the '/MTd and /clr options are incompatible' thing - can your try and build your application with shared MFC libraries (or '/MDd')? Go to your Project Properties (ALT+F7), select "Configuration Properties|C/C++|Code Generation" and change "Runtime Library" to "Multithreaded Debug DLL" - "DLL" is the important part here.
0
 
LVL 15

Expert Comment

by:Karrtik Iyer
ID: 40591026
Is it possible for your to attach your test program that you are trying to build and run using MS VS 2013?
0
 
LVL 33

Expert Comment

by:sarabande
ID: 40591514
>>Remove that component and use one that is not .net based.

which common dialog did you use? it is a good chance that mfc also provides a similar dialog.

Sara
0
 
LVL 33

Expert Comment

by:sarabande
ID: 40639850
actually the answer was given by Andy and not by me. therefore he should get the points.

Sara
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40639854
Thanks sara
0
 

Author Comment

by:Dave Shields
ID: 40642992
I've answered this problem myself, by disregarding instructions that I had been following in a book from 2002.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40643012
What did you do to solve it.
0
 

Author Comment

by:Dave Shields
ID: 40647234
Look, this was so hectic, trying to get an answer under a deadline, I honestly believe I solved this myself.  I do recall that I did pay attention to sara's comments, and did intereract with her so it would be appropriate if you awarded the points to her.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 33

Expert Comment

by:sarabande
ID: 40647296
Dave, thanks. I appreciate your comment.

Eenookami, in my comment I referred to an answer given by Andy and asked for more information which was not given for the reasons Dave has elaborated.

since I added only minimal value to the answer - if at all - I recommend to close the question by accepting Andy's comment http://www.experts-exchange.com/Programming/Misc/Q_28610058.html#a40588998.

Sara
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40647420
>>I do recall that I did pay attention to sara's comments, and did intereract with her so it would be appropriate if you awarded the points to her.

That sort of implies you ignored anyone else, including the first comment instructing you not to use that new component you added and use a different one instead.
0
 

Author Comment

by:Dave Shields
ID: 40648053
Andy
Can you refresh my memory on the comment that you made, as I do not remember any of your comments being on point.
Dave
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40648073
? Just look - it is the very first comment in response to your question.
0
 

Author Comment

by:Dave Shields
ID: 40649334
Andy are referring to this comment
"You can run MFC and .net together but it is rather complex. "
That is probably true, but as I have stated, the crux to the solution was to abandon the book I was following, and I picked up on Sara's questions about classes, I had been adding a class to the project, which was necessary in VS2003, but was completely causing a stumbling in VS2013.  

Your comment that MFC and .net can run together was of NO help to me.  It is very generous of Sara to defer the points to you, but I don't find that fair.  Sara and I had a fairly long conversation over several days.  She gave me code to get over the first hurdle, and her questions actually led me to find the answer, by looking closely at the classes in 2003 vs 2013.  

I don't remember all the details, but I do feel that Sara's correspondence was always on point.  Truthfull I didn't understand many other posts.

Dave
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40649366
>>Andy are referring to this comment
Actually no, that is a part of the comment.

As you seem to have real troubles with your browser I'll copy and paste the rest and more relevant part - because that is the bit Sara referred to - of it here.

You have added a .net based component (according to the clr requirement in the error message).  Remove that component and use one that is not .net based.

That seems to be precisely what you 'discovered yourself' some days later.


>>Sara and I had a fairly long conversation over several days.

Four experts made one comment each, then you closed the question without making any intermediate comment yourself.  My understanding of conversation apparently differs from yours,


>> Truthfull I didn't understand many other posts.

OK, so jkr and myself were talking in too advanced a way - if that happens just ask nicely to dumb down our level to something you can cope with.  Ignoring means you just ignore top quality advice.
0
 

Author Comment

by:Dave Shields
ID: 40649508
Actually by this point I was out of the woods thanks to Sara.  What I wanted to do was activate a Browse button on the dialog, by calling up a common file dialog.   I eventually found a code example online which worked smoothly.  It adds a great deal to my program.  I could NOT in my opinion do without this   A Browse button saves a lot of typing and typos.  Evntually I resorted to searching on line for the error codes associated with this addition.  As i recall, I had to make changes to 5 different items before the code would compile.

So, you see I could not take your advice even if I understood it, as the Browse feature was an essential design choice.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 40649557
deja vu:

 Remove that component and use one that is not .net based.
0
 

Author Comment

by:Dave Shields
ID: 40649859
Remove that component and use one that is not .net based.????????????
I originally planned on using a Microsoft common file dialog, and I did use a Microsoft common file dialog.  By finding code samples that showed me how to do it.  If the component was net based originally, I think it is still NET based.  What's your point.
     What I asked for was help in modifying the compiling switches, which you never mentioned, and which I was able to find online.

Dave
0
 
LVL 33

Expert Comment

by:sarabande
ID: 40650667
Force accept
probably you meant 'forced assist' ...

Sara
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 94
Turning python script into an applet 12 104
FMX TCameraComponent Problem 2 52
Java Loop 6 49
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now