Improve company productivity with a Business Account.Sign Up

x
?
Solved

add working uncompiled dll to project?

Posted on 2004-10-04
3
Medium Priority
?
265 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 2000 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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

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…
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…
Through the video, you can check the migration process of Outlook PST file to PDF. Kernel for Outlook to PDF tool can convert Outlook emails with all attributes like Subject, To, From, Cc, Bcc and other folders such as Inbox, Outbox, Sent Items, Jun…

606 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