Solved

add working uncompiled dll to project?

Posted on 2004-10-04
3
250 Views
Last Modified: 2010-04-24
hi all,

first off: NEWB ALERT!!!!  i don't know much about c++.

I have a managed c++ libary that works great.   The way I compile it is with vs command prompt with a makefile.   This libary consists of a single c++ file that compiles into a dll.   I would like the file to compile with my entire solution, a mix of c, and vb.net projects, instead of it being a separate referenced dll.  I am not the author of the file.

I have tried adding it into it's own c++ class project with in my solution, but I can't get it to compile.   There are several errors.   Pretty much what I did was try to create a blank C++ project, add the file, and compile it.   I also used the wizards blank c++ class library, but still no luck.

How can I create a project in my solution that i can just copy the contents of this already working code?

here is the working makefile that I'm using currently with vs.net command prompt using nmake:

all:            AfSecu.dll
AfS.dll: src\AfS.cpp
cl /nologo /clr /LD  src\AfS.cpp  /link /nodefaultlib /noentry  mscoree.lib nochkclr.obj
del AfS.obj

If this is a super newbie question, forgive me :/

thx in advance.
0
Comment
Question by:OnlineNoob
  • 2
3 Comments
 
LVL 19

Expert Comment

by:drichards
ID: 12223764
What kind of errors do you get?  You should be able to add a new .NET Class Library C++ project and replace the generated cpp file with your existing one.  There will be some additional options used by default, but all the basic options you are using will be the defaults.

Are you using the correct project type?
0
 
LVL 1

Author Comment

by:OnlineNoob
ID: 12223823
Ok, I added a new class project to my solution like before and used the nameofproject.cpp file that is created.  The file comes prebuilt with two includes, some stdafx.h and name of myProject.h.  If I comment out the includes, and append the working code to that default cpp file, then I get this error:

"fatal error C1010: unexpected end of file while looking for precompiled header directive."

If I uncomment out those 2 include files and try to compile, I get 5 errors:

4 of the errors are:
warning C4018: '>=' : signed/unsigned mismatch
and the other error in that group is:
warning LNK4099: PDB 'libc.pdb' was not found with 'C:\vsnetPath\vc7\lib\nochkclr.obj' or at 'C:\myProjectPath\Debug\libc.pdb'; linking object as if no debug info.

The makefile which I use to compile the dll before does mention the files listed in the error code.   All I do is open up the location of the makefile in my vs.net console, and type nmake and it makes the dll without errors, and I use the dll without errors.
0
 
LVL 19

Accepted Solution

by:
drichards earned 500 total points
ID: 12228585
You can comment out the '#include  "stdafx.h"' line, but you'll have to go into the properties for that file (right click on file in SOlution Explorer and seect "Properties") and choose "Not Using Precompiled Headers" on the Precompiled Headers page "Create/Use Precompiled Header" line.  If you use precompiled headers, stdafx.h must be included in your source files.  The signed/unsigned mismatch was always there and can be either ignored or fixed.  I'm not exactly sure why you get the linker warning, but it shouldn't affect your executable.  It can't find the program database (used for debugging) for libc.

You can look in the linker properties for the project and go to the Input page and see if "Ignore All Default Libraries" is set to No.  If so, select /NODEFAULTLIB to match your makefile settings. That may get rid of the warning.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

746 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

13 Experts available now in Live!

Get 1:1 Help Now