Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

add working uncompiled dll to project?

Posted on 2004-10-04
3
256 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mask Input via OpenSSH 21 106
Destory  window  not working 2 142
Paint/Redraw window while dragging 16 82
send messages to whatsapp programatically 2 62
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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