|
A precompiled header is the stdafx.h file in your project. If you're using precompiled headers, the first include in all of your .cpp files needs to be this file. Any files included before it will be ignored. People often get errors with this, if they find a cpp file on the web and put it into their project, but it doesn't include the file.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If they are new to VC6.0 IDE and they are compiling their first program, they'll certainly find it saying "Cannot Open precompiled header file : TheirProgram.pch". I thought that could be the case
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
i downloaded a program from the Internet. It reference s a header file file called sockets.h. When i try to run my program, i get a compile error saying that sockets.h wasn't found. Quite a few other header files are missing too. How can i resolve this?
|
|
|
|
|
Did you see that site for sockets.h
|
|
|
|
|
I'm sorry, i couldn't understand what you meant.
|
|
|
|
|
mostly this would be the problem with the #include<> and #include" ".. or you sure you used #include "sockets.h" I mean if you have the file. If you dont have it, search for it. No other way.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
i used #include<>. I guess i'll have to find the file on Google.
|
|
|
|
|
if the header file is stored locally, I mean where the .cpp files are stored, you should use #include "myheader.h"
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
You download a program of internet what files is in this program
|
|
|
|
|
I don't see, if sockets.h is a platform/SDK header. Try commenting that header, whether error you would get for functions; are application specific or somethig else.
|
|
|
|
|
i tried to find the file using Windows Search but i coudn't find it. It there another library i could use for socket programming.
|
|
|
|
|
so is this what you've beeing trying to do? You have lovely API for thatWinSock Search CP for "Winsock". You'll need to scroll for pages.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
As I said, it could be other applicatin specific header. Try commenting it out.
Mridang Agarwal wrote: It there another library i could use for socket programming.
If you are using MFC , you can go with Socket classes.
Otherwise use winsock[^].
|
|
|
|
|
i tried commenting it out but it then the program doent run because all the the socket functions dont work.
|
|
|
|
|
Can you name the functions that are giving errors?
|
|
|
|
|
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include "helper.h"
#include <stdlib.h>
#include <stdio.h>
#define ECHO_PORT (2002)
#define MAX_LINE (1000)
int main(int argc, char *argv[]) {
int list_s;
int conn_s;
short int port;
struct sockaddr_in servaddr;
char buffer[MAX_LINE];
char *endptr;
if ( argc == 2 ) {
port = strtol(argv[1], &endptr, 0);
if ( *endptr ) {
fprintf(stderr, "ECHOSERV: Invalid port number.\n");
exit(EXIT_FAILURE);
}
}
else if ( argc < 2 ) {
port = ECHO_PORT;
}
else {
fprintf(stderr, "ECHOSERV: Invalid arguments.\n");
exit(EXIT_FAILURE);
}
if ( (list_s = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) {
fprintf(stderr, "ECHOSERV: Error creating listening socket.\n");
exit(EXIT_FAILURE);
}
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(port);
if ( bind(list_s, (struct sockaddr *) &servaddr, sizeof(servaddr)) < 0 ) {
fprintf(stderr, "ECHOSERV: Error calling bind()\n");
exit(EXIT_FAILURE);
}
if ( listen(list_s, LISTENQ) < 0 ) {
fprintf(stderr, "ECHOSERV: Error calling listen()\n");
exit(EXIT_FAILURE);
}
while ( 1 ) {
if ( (conn_s = accept(list_s, NULL, NULL) ) < 0 ) {
fprintf(stderr, "ECHOSERV: Error calling accept()\n");
exit(EXIT_FAILURE);
}
Readline(conn_s, buffer, MAX_LINE-1);
Writeline(conn_s, buffer, strlen(buffer));
if ( close(conn_s) < 0 ) {
fprintf(stderr, "ECHOSERV: Error calling close()\n");
exit(EXIT_FAILURE);
}
}
}
this is the code. there is one more file called "helper.h". this file contaisn cote for the readline and write functions. nothing important.
|
|
|
|
|
Mridang Agarwal wrote: #include <sys socket.h=""> /* socket definitions */#include <sys types.h=""> /* socket types */#include <arpa inet.h="">
Hey this is for UNIX!!
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
BTW, why did you say SOCKETS.h????? .. You really wasted many's time. When you ask something please see to that you are asking with the correct details.If you had mentioned the right word, we could have helped you faster. Good Luck nextime.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
i am really sorry guys. A messed up and all because of a small tpyo. Won't happen again. Thanks for all the help.
|
|
|
|
|
It's ok dude.. No problem
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Did you find this file?
|
|
|
|
|
I am using this code to save data in txt file but i just dont understand what went wrong in that it saves all data rather then that market detail only.
<br />
<br />
CString csMarket="EURUSD";<br />
CString usMarket ="USDJPY";<br />
CString gbMarket="GBPUSD" ;<br />
<br />
if(csMarket == Market)
{<br />
myfile.Open("EurUsd.txt",CFile.modeCreate | CFile.modeWrite);<br />
<br />
LPSTR buf;<br />
int i= m_MainEdit.GetLength();<br />
buf = m_MainEdit.GetBuffer(i);<br />
myfile.Write(buf,i);<br />
myfile.Close();<br />
<br />
}<br />
else if(strcmp( Market,"USDJPY") == 0) <br />
<br />
{<br />
myfile.Open("UsdJpy.txt",CFile.modeCreate | CFile.modeWrite);<br />
LPSTR buf1;<br />
int i = m_MainEdit.GetLength();<br />
buf1 = m_MainEdit.GetBuffer(i);<br />
myfile.Write(buf1,i);<br />
myfile.Close();<br />
}<br />
<br />
else if(gbMarket == Market)<br />
{<br />
myfile.Open("GbpUsd.txt",CFile.modeCreate | CFile.modeWrite);<br />
<br />
LPSTR buf2;<br />
int i = m_MainEdit.GetLength();<br />
buf2 = m_MainEdit.GetBuffer(i);<br />
myfile.Write(buf2,i);<br />
myfile.Close();<br />
<br />
}<br />
|
|
|
|
|
Show the definition of Market . Wont thing's be more easier if you store your Market in a CString csMarket ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Market is the name of market like2 "usdjpy","gld","slv" etc and with this, rate of market and the days highest "bid" and the lowest "bid"
|
|
|
|
|
Try this,
<br />
CString Market;<br />
<br />
if(Market==usMarket)<br />
{<br />
}<br />
else if(Market==csMarket)<br />
{<br />
<br />
}<br />
else if(Market==gbMarket)<br />
{<br />
<br />
}<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|