iostream problem...

General questions regarding the usage of CodeLite
cgillopez
CodeLite Curious
Posts: 6
Joined: Thu Feb 25, 2010 7:50 pm
Genuine User: Yes
IDE Question: c++
Contact:

iostream problem...

Post by cgillopez »

hello,

i wanna compile a program but i get some errors and i dont know what do i have to do. I hope you can give me a solution. Im using Windows, codelite v2.6.0.4189

gcc -c "C:/Program Files/CodeLite/h264_C++/main.c" -g -o ./Debug/main.o "-I." "-I."
C:/Program Files/CodeLite/h264_C++/main.c:4:20: error: iostream: No such file or directory
C:/Program Files/CodeLite/h264_C++/main.c:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'
C:/Program Files/CodeLite/h264_C++/main.c:14: error: expected ';', ',' or ')' before '&' token
C:/Program Files/CodeLite/h264_C++/main.c:25: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'aGlobalUsername'
C:/Program Files/CodeLite/h264_C++/main.c:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'aGlobalPassword'
C:/Program Files/CodeLite/h264_C++/main.c:28: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'aGlobalRunning'


C:/Program Files/CodeLite/h264_C++/main.c:87: error: 'string' undeclared (first use in this function)

when my code is...

#include <stdio.h>
#include <getopt.h>
#include <signal.h>
#include <iostream>

using namespace std;



static void run(const string& theServer, unsigned int thePort,
const string& theURI, RTSPSession::ConnectionMode theMode,
bool theMulticastFlag, unsigned int theMediaMode,
const string& theOutputFile, const string& theSDPFile);
static void usage(void);
static void signal_handler(int signum);

/****************** GLOBAL VARIABLE DECLARATION SECTION *********************/

int aGlobalVerboseFlag = 0;
int aGlobalStatisticsFlag = 0;
string aGlobalUsername = "root";
string aGlobalPassword = "pass";
int aGlobalDelay = 0;
bool aGlobalRunning = true;

int main(int argc, char **argv)
string urui;
{...}

Thanks in advance for your help.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: iostream problem...

Post by eranif »

You are compiling C++ code with C compiler (the file is named main.c, and the compiler used is gcc while it should be g++)
In addition, dont forget to include '#include <string>' (without .h)
Eran
Make sure you have read the HOW TO POST thread
cgillopez
CodeLite Curious
Posts: 6
Joined: Thu Feb 25, 2010 7:50 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: iostream problem...

Post by cgillopez »

Thank you eranif, now its working.
Post Reply