473,385 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How can I build a cpp file not in a project?

jr
I'm working with VC++ 7, but I think this rather dumb question is C++
related rather than Vis Studio related.

If this is the wrong place - apologies, just ignore it!
I am trying to use log4cpp, and I downloaded the zip files. When I wish to
use it in my code I can #include the required header file. However, when I
build I get link problems. This is because the cpp files are not being found
or compiled. I can tell VS to look in the correct folder for the cpp, but
that's not enough (C++ Directories).
Am I missing something here? I don't see why I should expect the compiler to
compile these library files but I do. Should I compile them as a separate
project do you think? I must say that I don't understand pre-compiled
headers either - is this something I should be looking at!

I know this is Vis Studio biased, but the problem is that there's a general
principle I don't understand.
Can you help?
Please excuse the extreme stupidity of this post.

Thanks very much.

john

--
---
If you need to reply personally, append "text" to the domain name in my
email adr.
Thanks
Jul 22 '05 #1
2 1410
The quick fix for this is just create a new folder in your project's
"solution explorer" (that thing down the right) called log4cpp and put all
the c/cpp files into that. Then visual studio will know they need to be
compiled.
If you want you can make another project which just compiles this files.
Then add this project to your current solution and set your first project to
depend on the log4cpp project, and as such they will be compiled when/if
needed.

If the files aren't listed in your solution explorer they won't be compiled
or linked in. You can hope VC will compile them, but to be honest it doesn't
know which it should if any. The header files you are importing don't say
anything about where the actual code is, but when you add them to the
solution explorer it compiles them, and then later sees the compiled code
with the create function names at the linking stage.

Hope thats helpful?
Andrew

"jr" <jo***@tele.co.uk> wrote in message
news:c7**********@news6.svr.pol.co.uk...
| I'm working with VC++ 7, but I think this rather dumb question is C++
| related rather than Vis Studio related.
|
| If this is the wrong place - apologies, just ignore it!
|
|
| I am trying to use log4cpp, and I downloaded the zip files. When I wish to
| use it in my code I can #include the required header file. However, when I
| build I get link problems. This is because the cpp files are not being
found
| or compiled. I can tell VS to look in the correct folder for the cpp, but
| that's not enough (C++ Directories).
| Am I missing something here? I don't see why I should expect the compiler
to
| compile these library files but I do. Should I compile them as a separate
| project do you think? I must say that I don't understand pre-compiled
| headers either - is this something I should be looking at!
|
| I know this is Vis Studio biased, but the problem is that there's a
general
| principle I don't understand.
| Can you help?
| Please excuse the extreme stupidity of this post.
|
| Thanks very much.
|
| john
|
| --
| ---
| If you need to reply personally, append "text" to the domain name in my
| email adr.
| Thanks
|
|
Jul 22 '05 #2

"jr" <jo***@tele.co.uk> wrote in message
news:c7**********@news6.svr.pol.co.uk...
I'm working with VC++ 7, but I think this rather dumb question is C++
related rather than Vis Studio related.

If this is the wrong place - apologies, just ignore it!

It is the wrong place.

I am trying to use log4cpp, and I downloaded the zip files. When I wish to
use it in my code I can #include the required header file. However, when I
build I get link problems. This is because the cpp files are not being found or compiled. I can tell VS to look in the correct folder for the cpp, but
that's not enough (C++ Directories).
Am I missing something here?
Yes, add the files to your project. Menu item File/Add Existing Item...

I don't see why I should expect the compiler to compile these library files but I do. Should I compile them as a separate
project do you think? I must say that I don't understand pre-compiled
headers either - is this something I should be looking at!


No, its got nothing to do with it.

john
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: carrot | last post by:
With .Net Studio, I have a solution includes some projects. I want to execute a batch file during build solution time. For example, 1'st project is builded. 2'nd project is builded. " a batch...
6
by: Alan Krueger | last post by:
Is there a way to automatically include C# files (.cs) generated by a third-party tool into a Visual C# .NET build? It's possible the set of files generated by this tool might change. Adding...
0
by: greg | last post by:
I created deployment project for my web application (to install on the same computer so I dont need to add runtime) Added project output AND content files would not build content...
3
by: prabhupr | last post by:
Hi Folks Not sure if this is the right group, if not please re-direct me to the right one. Here is my question =============== When I compile my ASP.NET WEB project from VS 2005 (.NET...
2
by: Peter Ritchie | last post by:
In VS/VC 2003: Simple question: for the Custom Build Step for the project (right click the project in the Solution Explorer, select "Properties", select the "Custom Build Step" in the...
5
by: Al | last post by:
Hi all We have created a xml file that imports a single project using the Import element. This project compiles to a class library, but has references to two other projects that are also class...
1
by: Matt Fielder | last post by:
I need to customize the build process beyond just selecting which projects get built in what order. What I want to happen is when I select "Release" 1: Pop a dialog confirming I want to build...
8
by: Bruce | last post by:
I am using VB in Vs2005. Am I missing something or does VB not have the concept of "builds" (release/debug) like in VC? I wrote an assembly and I would like to have a debug version of the DLL...
6
by: =?Utf-8?B?YXByMDUyNA==?= | last post by:
I am wondering if there is a devenv switch that will ignore build dependencies that are set in .xxproj files. At the command line I am attempting to build individual projects that I do not want...
1
by: =?Utf-8?B?Q2h1Y2sgUA==?= | last post by:
I have an asp.net solution with a web deployment project. When we try to build/debug, we get the message: An editor or project is attempting to check out a file that is modified in memory,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.