add working uncompiled dll to project?

Posted on 2004-10-04
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 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 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.
Question by:OnlineNoob
  • 2
LVL 19

Expert Comment

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?

Author Comment

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 console, and type nmake and it makes the dll without errors, and I use the dll without errors.
LVL 19

Accepted Solution

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.

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

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++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 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