|
Hello all,
I got the following makefile for the GD Library (http://www.fred.net/brv/chart/gdchart0.94b.tar.gz[^] :
GDC_INCL = .
GD_INCL = gd1.3
GD_LIB = gd1.3
CC=gcc
all: gdc_samp1 gdc_samp2 gdc_pie_samp
# compile the samples
gdc_samp1: gdc.o gdchart.o price_conv.o gdc_samp1.o $(GD_LIB)/libgd.a
$(CC) -o gdc_samp1 gdc.o gdchart.o price_conv.o gdc_samp1.o -L$(GD_LIB) -lgd -lm
gdc_samp1.o: $(GDC_INCL)/gdc.h $(GDC_INCL)/gdchart.h gdc_samp1.c
$(CC) -I$(GDC_INCL) -c gdc_samp1.c
gdc_samp2: gdc.o gdchart.o price_conv.o gdc_samp2.o $(GD_LIB)/libgd.a
$(CC) -o gdc_samp2 gdc.o gdchart.o price_conv.o gdc_samp2.o -L$(GD_LIB) -lgd -lm
gdc_samp2.o: $(GDC_INCL)/gdc.h $(GDC_INCL)/gdchart.h gdc_samp2.c
$(CC) -I$(GDC_INCL) -c gdc_samp2.c
gdc_pie_samp: gdc.o gdc_pie.o price_conv.o gdc_pie_samp.o $(GD_LIB)/libgd.a
$(CC) -o gdc_pie_samp gdc.o gdc_pie.o price_conv.o gdc_pie_samp.o -L$(GD_LIB) -lgd -lm
gdc_pie_samp.o: $(GDC_INCL)/gdc.h $(GDC_INCL)/gdcpie.h gdc_pie_samp.c
$(CC) -I$(GDC_INCL) -c gdc_pie_samp.c
# --- compile the lib ---
price_conv.o: price_conv.c
$(CC) -c price_conv.c
gdc.o: gdc.c gdc.h
$(CC) -I$(GD_INCL) -I$(GDC_INCL) -c gdc.c
gdc_pie.o: $(GDC_INCL)/gdc.h $(GDC_INCL)/gdcpie.h gdc_pie.c
$(CC) -I$(GD_INCL) -I$(GDC_INCL) -c gdc_pie.c
gdchart.o: $(GDC_INCL)/gdc.h $(GDC_INCL)/gdchart.h gdchart.c
$(CC) -I$(GD_INCL) -I$(GDC_INCL) -c gdchart.c
$(GD_LIB)/libgd.a:
cd $(GD_LIB) ; make -f Makefile libgd.a
# --- clean ---
clean:
rm -f *.o gdc_samp1 gdc_samp2 gdc_pie_samp
cd $(GD_LIB) ; make -f Makefile clean
My problem is :
1. How did the make file compile and link the gdc_samp1.c file ?
Really appreciated if anyone could have some answers ...I am a BIG NOOB in linkers...
Thanks,
Leslie
|
|
|
|
|
It follows the rules from all -> gdc_samp1 -> gdc_samp1.o -> gdc_samp1.c .
Just follow target dependencies to their associated targets, then follow those dependencies to their targets, until you get dependencies which have no corresponding target, at which point, either a) the file must exist, or b) there must be an implicit rule that knows how to make that file from some other file. Quite simple really.
Here's a useful intro to Makefiles[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Your question has little to do with linkers.
Make files follow a fairly simple syntax:
build_target1: dependency1.o dependency2.o build_target2 ....etc.
commands to build the build target
build_target2:
command(s) needed to build this build target.
So, looking at your make file:
# compile the samples
gdc_samp1: gdc.o gdchart.o price_conv.o gdc_samp1.o $(GD_LIB)/libgd.a
$(CC) -o gdc_samp1 gdc.o gdchart.o price_conv.o gdc_samp1.o -L$(GD_LIB) -lgd -lm
The build target "gdc_samp1:" is what defines all that is needed to make the gdc_samp1. So, make converts the line:
$(CC) -o gdc_samp1 gdc.o gdchart.o price_conv.o gdc_samp1.o -L$(GD_LIB) -lgd -lm
to:
gcc -o gdc_samp1 gdc.o gdchart.o price_conv.o gdc_samp1.o -L$(GD_LIB) -lgd -lm
For more info on make files: Clickety[^]
Hope this helps
|
|
|
|
|
The GNU Make Manual.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am currently developing an application using C++ and MFC. I am thinking about buying a copy of DevPartner Studio to run as part of my development efforts. This product claims to catch memory leaks and other errors related to memory. I have a 14 day trial license of the product and I am undecided on whether or not to buy. I am also wondering, how reliable the product is.
If you are a fan of DevPartner Studio, I would like to hear from you.
Thanks
Bob
|
|
|
|
|
I've used it, had a license at one point - but the last time I looked, it's got insanely expensive.
Add to that the fact that the last time I got an evaluation license, I found a crashing bug (which I reported and was acknowledged) doing what seemed like quite straight forward things and I was less than impressed.
Howver - there don't seem to be that many options in that space.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It's very expensive, but I like it a lot. It's one of those tools that when you need it, you really need it and nothing else I've tried works nearly as well. It has it's quirks and CompuWare seems to go in phases as to how much it pays attention to the product, but I've found it to be fairly reliable and the big changes they made in (I think 8) were great.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello guys, i'm a c++ beginner
i'm trying to move or copy a text file into another binary file through this code but it doesn't work ;
#include <iostream>
#include <fstream>
const static int BUF_SIZE = 4096;
using std::ios_base;
int main(int argc, char** argv) {
std::ifstream in ( ("C:\\forTest.txt"), ios_base::in | ios_base::binary);
std::ofstream out ( ("C:\\Test.bin"), ios_base::out | ios_base::binary);
char buf[BUF_SIZE];
do {
in.read(&buf[0], BUF_SIZE);
out.write(&buf[0], in.gcount());
} while (in.gcount() > 0);
in.close();
out.close();
}
Then i want to know how to get the file information like, size, last modification...etc
Thanks in advance
|
|
|
|
|
In your last thread on CodeProject people stopped helping you. My guess is because you seem to want people to give you solutions rather than help you understand things yourself. That's not normally a popular thing around here.
My advice to all beginners is learn how to read reference material. The following link to a C++ reference is not using the Standard Template Library but does show one way to get the length of a file. Reference documentation for the STL does exist. I strongly urge you to learn to find/read and understand references to learn C++ from rather than posting messages in internet forums.
http://www.cplusplus.com/reference/clibrary/cstdio/ftell.html[^]
|
|
|
|
|
Hmm, Don't see any thing so bad in the code. But you can use just "buf" instead of &buf[0]. Also, I prefer this way
while(!in.eof())
{
in.read(buf, BUF_SIZE);
out.write(buf, in.gcount());
}
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
moody123 wrote: i'm trying to move or copy a text file into another binary file
What do you mean exactly ? Do you want to append it to an existing binary file (at the end, start, ...), create a new file with the exact same content as your text file, ... ?
moody123 wrote: but it doesn't work ;
Same question. What do you mean exactly by doesn't work ? What were you expecting and what did you get ?
Please be specific.
|
|
|
|
|
moody123 wrote: ...but it doesn't work ;
Which means?
moody123 wrote: Then i want to know how to get the file information like, size, last modification...etc
Have you looked into GetFileAttributes() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
simply all what i wanted is copy a file into an other binary file!!!
and i've tried to replace &buf[0] with buf just as (VuNic) said, and it worked!!!
then about what (led mike) has said; the problem is that i've a deadline to do this and the course which related to doing this programe it's not about programming!! it's about data security!!!
so don't think that i'm just posting a thread to hear comments like yours!! of course you didn't try to work under pressure, deadline, and without any c++ background!!!
David i'll have a look on that.
|
|
|
|
|
Hi,
I am launching my application which is an MDI application which does some injection to the processes. After keeping my system idle for some time (40 min) I am getting "Insufficient system resources exist to complete the requested service." message. Same time I am checking with Application event viewer which shows following error message. We have installed Service Pack 3 for Windows XP.
---------------------------------------------------------------------------------------------------
Error
*****
The description for Event ID ( 20 ) in Source ( Google Update ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Network Request Error.
Error: 0x80042197. Http status code: 407.
Url=https://tools.google.com/service/update2
Trying config: source=IE, named proxy=proxych1.techmahindra.com:8080, bypass=*.techmahindra.com;10.*.*.*;172.*.*.*;192.*.*.*;<local>.
trying CUP:WinHTTP.
Send request returned 0x80042197. Http status code 407.
trying WinHTTP.
Send request returned 0x80042197. Http status code 407.
trying CUP:Browser.
Send request returned 0x80004005. Http status code 0.
Trying config: source=winhttp, direct connection.
trying CUP:WinHTTP.
Send request returned 0x80072ee2. Http status code 0.
trying WinHTTP.
Send request returned 0x80072ee2. Http status code 0.
trying CUP:Browser.
Send request returned 0x80004005. Http status code 0.
Trying config: source=auto, wpad=1, script=.
trying CUP:WinHTTP.
Send request returned 0x80072ee2. Http status code 0.
trying WinHTTP.
Send request returned 0x80072ee2. Http status code 0.
trying CUP:Browser.
Send request returned 0x80004005. Http status code 0
---------------------------------------------------------------------------------------------------
Please let us know what could be the problem out here. When I am trying to get GetLastError it gives me "0" as there is no problem.
Thanks
SNI
SNI
|
|
|
|
|
Hello, everyone
Recently I use g++ to compile cpp files with a -static paramter, and I got an compiler error as below:
/homes/judge/source/31.cpp:7:2: warning: no newline at end of file
ld: fatal: library -lm: not found
ld: fatal: library -lc: not found
ld: fatal: library -lc: not found
ld: fatal: File processing errors. No output written to /homes/judge/exe/4090
collect2: ld returned 1 exit status
I guess may be it happened by problem of system environment, the /etc/profile list out here:
<br />
MANPATH=$MANPATH:/usr/local/man<br />
LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/ld:/usr/lib<br />
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/export/home/mysql/mysql-5.1.32/lib<br />
CC=gcc<br />
<br />
export LD_LIBRARY_PATH<br />
export CC<br />
export MANPATH<br />
<br />
<br />
JAVA_HOME=/Desktop/jdk1.6.0_12<br />
<br />
<br />
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib<br />
export CLASSPATH<br />
<br />
CATALINA_BASE=/usr/local/tomcat<br />
CATALINA_HOME=/usr/local/tomcat<br />
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin:$CATALINA_HOME/bin:/usr/sfw/bin:/usr/local/bin:/usr/bin:/usr/ccs/bin:/sur/sbin<br />
export PATH
Any suggestion for this problem? Thanks in advance!
no cross no crown.
|
|
|
|
|
It seems that u r missing some static libraries
|
|
|
|
|
|
g++ should be able to find libc and libm (those are the two that you're having issues with). Are you sure Solaris supports static linking? I've just tried the same test on OS X (10.5.6) and, while gcc accepts -static, not all static libraries are present.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: g++ should be able to find libc and libm
You mean that I need add the path include the libc&libm into system environment? When I use -lm parameter it works, isn't -lm says g++ compiler is using the math library compiling code, namely the libm? But with a -static will occur that error.I confused that a little.
Stuart Dootson wrote: Are you sure Solaris supports static linking
I think the -static is belong to g++ and independence of platform(solaris/fedora..), but I am too new one to confirm this. I guess it due to a library g++ can't find.
The key is that I try writting a program about online judge program(some thing like ACM), it did not work well without the -static parameter while compiling period. I have to compile like this: g++ %s/%d.cpp -o %s/%d -ansi -fno-asm -Wall -lm -DONLINE_JUDGE --static 2> %s/%d.txt
I am very need your suggestions, thanks for your time!
no cross no crown.
|
|
|
|
|
Sorry, I google it, finally find the static linking on Solaris 10 was removed.
Now, I need to think changing to a linux server.
Thank you sir.
no cross no crown.
|
|
|
|
|
David Wong RZ wrote: Sorry, I google it, finally find the static linking on Solaris 10 was removed
No worries - glad you found an explanation for your problem!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
How to create window with Transparency level starts from 0 to 100%?
Left side transparency level = 0%
Right side transparency level = 100%
Is it possible to use AlphaBlend() API.
Is it possible to use GradientFill() method of CDC.
pls let me know with sample
|
|
|
|
|
|
Thanks 4 ur help.
Ur link is helpful, but it uses GDIplus and it is not my requirement.
I need to use only MFC.
Anyway it will b useful if u explain the method Refresh() of class CImgBaseDialog in more detailed manner.
I understood rest of the stuffs like hooking, unhooking, etc.,
Thanks n advance!!!
|
|
|
|
|
The sample uses the GDI+ to load PNG / TIFF image.
U can modify the code to use CXimage http://www.codeproject.com/KB/graphics/cximage.aspx[^] and normal GDI
The Refresh() method in CImgBaseDialog works as the following:
Paint the background first.
Enumerate all child controls, and for each of them, send WM_PRINT to get the captured bitmap, paint at the same place of the fake window.
Finally, caculate the position of caret, draw the caret.
----------------------------------------------------------------
English is not my native language
|
|
|
|