Click here to Skip to main content
15,886,680 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello,
i'm trying to compile a solution that contains 2 projects. the main project is an mfc application (linked statically). the second is a non-mfc library. when i compiile, i get errors regarding new being redefined etc. is this two-project approach a bad idea? should i set the non-mfc project to link to mfc as well, even though it doesn't need it?

thanks for any advice,
ed
Posted
Comments
[no name] 4-Feb-12 11:52am    
Can you please paste actual error you are getting with your question? And by the way, having more one project in one solution doesn't cause any problem
Maximilien 4-Feb-12 16:56pm    
Are you able to load each project and build them individually ?

In studio, each project can have it's own project settings, even if they're contained in the same solution. You probably just have something configured incorrectly. The compilations of each project are still independent of one another, even in the same solution (each can have its own settings, pre-compiled header, etc.).
 
Share this answer
 
thanks for your replies. to provide more detail:
i had a project i'd worked on a few years ago, using VC6. i wanted to port it to VC2005, so i imported the vc6 project files and converted them without problems. after fixing minor compilation errors in the source code, i tried to link, and got the infamous KB148652 error (wrong link order for CRT and MFC libraries) in the second (non-MFC) project. the KB article instructed me to force the correct order by creating a file called Forcelib.h, which i did. when i included Forcelib.h in files from my second project that seemed to be causing the link error (i.e., they didn't include Afx.h, even indirectly), i got the following link error:

C:\...\VC\include\new.h(94) : error C2733: second C linkage of overloaded function 'operator new' not allowed<br />
C:\...\VC\include\new.h(93) : see declaration of 'operator new'


i haven't had time to try your suggestion of compiling/linking each project separately; the first needs the second to link, but i have a project that builds the second as a static library into a test program, and will try that.

another strategy i'm in the process of trying is to create two new VS projects (rather than using the imported ones) and adding all the files and changing the project settings to re-create the original projects, but that's going to take a while, they're large projects.

thanks for your suggestions, i'll post back in the next few days as i learn more.
 
Share this answer
 
v2
Comments
Rajesh Anuhya 4-Feb-12 22:00pm    
Edited: "Treat my content as plain text, not as HTML" disabled
--RA
Rajesh Anuhya 4-Feb-12 22:00pm    
??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900