473,770 Members | 6,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1429
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.po l.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.po l.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
2479
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 file is executed." 3'rd project is builded.
6
2305
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 these files manually to the project would work in the short term, but this would require manual intervention if these generated files happened to change, and I'd like to avoid any unnecessary manual steps. NAnt and similar tools can include and...
0
1193
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 files!!!!!!!!!!!!!!!!!!!!! I did the same thing with other projects it worked!!! Here is the output window ++++++++++++++++++++++++++++++++++++++++++++++ ------ Build started: Project: sbuilder, Configuration: Debug .NET ------
3
4266
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 Framework 2.0) IDE, it works fine, but if I use NANT (Build Automation) it gives me an error as follows:
2
1736
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 "Configuration Properties" tree at the left, then select "General" under "Custom Build Step"), what is the implicitly dependent file? My situation is, there is a file I would like to copy after the build; but, only if it has changed. I've added a "copy...
5
4472
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 libraries. We are having a path reference issue for the depending projects; if the build is started in another directory than that of the imported project. (It's a simple cannot find project xyz.csproj, build fails.) If we place the xml file in...
1
1667
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 (release build takes several minutes, and I regularly forget to switch back to "debug") 2: Build several projects in a specific order. 3: Run a batch file that checks everything out from VSS (can write the batch file, just need to call it here) 4:...
8
2172
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 and a release version of the DLL. I would like to create some sample code that demonstrates my assembly in VB and would like to have two builds, one using my debug version and the other using the release version of the assembly. How can I do...
6
5397
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 subjected to the build dependencies set in the project files.
1
2789
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, which will result in saving it. Saving files during the build process is dangerous and can result in incorrect build outputs in future. Do you want to continue with the check out?
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.