Results 1 to 6 of 6
I am using cygwin and when i compile program hello.cc
by command gcc hello.cc -o hello
it shows installation problem,cannot exec ‘cc’plus’:No such file or directory
but when i execute ...
- 04-08-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
Problem in compilation using cygwin
I am using cygwin and when i compile program hello.cc
by command gcc hello.cc -o hello
it shows installation problem,cannot exec ‘cc’plus’:No such file or directory
but when i execute program with command ./hello.exe
it shows output
how should i remove this problem plz tell me.
- 04-08-2011 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,956
It seems that you don't have the C++ compiler installed in your Cygwin environment. To check, try this: g++ hello.cc -o hello
That will invoke the C++ compiler if it exists. If not, then you will get a file/command not found error.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-08-2011 #3Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
compilation using cygwin
Thanks Sir,
Hello.cc is compiled properly with command
g++ hello.cc -o hello
Now i am to work on sense simulator using cygwin,for this i put sense-3.0.3 in
cygwin/usr/local/sense-3.0.3
after building of simulator with followin commands
In order to build the simulator:
cd sense-3.0.3/code
make
To build the examples:
make test
To build the utilities that will analysis the state of the SSR or SHR simulation:
cd analyzer/src
make
Then cxx file is made in sense-3.0.3/code/bin directory
and exe files are made of built-in program in sense-3.0.3/code/examples/sense directory
if i compile sim_80211.cc program by using following command
g++ sim_80211.cc -o sim_80211
it shows following errors
sim_80211.cc :14:2: error invalid Preprocessing directive #cxxdef
In file include from ../..common/cost.h:13
in file include from ../..common/sense.h:46
but when i execute sim_80211's exe file by command
./sim_80211.exe
it shows complete result
how this problem can be removed.
- 04-08-2011 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,956
Usually, you would place #ifndef/#endif statements around the offending #cxxdef statement, such as:
That will keep the compiler from seeing the #cxxdef line, and thus give no error or warning. Since the compiler apparently completed, my guess is that the preprocessor error was ignored in this case. Whether or not that may cause a problem is unknown since I don't have the offending source code to analyze.Code:#ifndef __CYGWIN__ #cxxdef ...whatever... #endif /* __CYGWIN__ */
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 04-08-2011 #5Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
cygwin compile errors in included files
Sorry Sir, but this command not working because compiler shows error in other included header files like
../../common/priority_q.h
error: no argument to 'strcat'
../../common/cost.h
error: expected initializer before '<' token
../../app/cbr.h
error: 'component' does not name a type
it seems that their is no linking between files.
i am sending complete source code in this reply
#define queue_t HeapQueue
#include "../../common/sense.h"
#include "../../libraries/visualizer/inc/Visualizer.h"
#include "../../app/cbr.h"
#include "../../mob/immobile.h"
#include "../../net/flooding.h"
#include "../../net/aodvi.h"
#include "../../net/aodvii.h"
#include "../../net/dsri.h"
#include "../../mac/null_mac.h"
#include "../../mac/mac_80211.h"
#include "../../phy/transceiver.h"
#include "../../phy/simple_channel.h"
#include "../../energy/battery.h"
#include "../../energy/power.h"
#include "../../util/fifo_ack.h"
#cxxdef net_component Flooding
#cxxdef net_struct Flooding_Struct
typedef CBR_Struct:
acket_t app_packet_t;
typedef net_struct<app_packet_t>:
acket_t net_packet_t;
typedef MAC80211_Struct<net_packet_t*>:
acket_t mac_packet_t;
component SensorNode : public TypeII
{
public:
CBR app;
net_component <app_packet_t> net;
MAC80211 <net_packet_t*> mac;
// A transceiver that can transmit and receive at the same time (of course
// a collision would occur in such cases)
DuplexTransceiver < mac_packet_t > phy;
// Linear battery
SimpleBattery battery;
// PowerManagers manage the battery
PowerManager pm;
// sensor nodes are immobile
Immobile mob;
// the queue used between network and mac
FIFOACK3<net_packet_t*,ether_addr_t,unsigned int> queue;
double MaxX, MaxY; // coordinate boundaries
ether_addr_t MyEtherAddr; // the ethernet address of this node
int ID; // the identifier
bool SrcOrDst;
virtual ~SensorNode();
void Start();
void Stop();
void Setup();
outport void to_channel_packet(mac_packet_t* packet, double power, int id);
inport void from_channel (mac_packet_t* packet, double power);
outport void to_channel_pos(coordinate_t& pos, int id);
};
SensorNode::~SensorNode()
{
}
void SensorNode::Start()
{
}
void SensorNode::Stop()
{
}
void SensorNode::Setup()
{
battery.InitialEnergy=1e6;
app.MyEtherAddr=MyEtherAddr;
app.FinishTime=StopTime()*0.9;
app.DumpPackets=false;
mob.setX( Random( MaxX));
mob.setY( Random( MaxY));
mob.setID( ID);
net.MyEtherAddr=MyEtherAddr;
net.ForwardDelay=0.1;
net.DumpPackets=true;
mac.MyEtherAddr=MyEtherAddr;
mac.Promiscuity=true;
mac.DumpPackets=false;
pm.TXPower=1.6;
pm.RXPower=1.2;
pm.IdlePower=1.15;
pm.BeginTime = 0.0;
pm.FinishTime = StopTime();
pm.failureStats( 0.0); // node always active
phy.setTXPower( 0.0280);
phy.setTXGain( 1.0);
phy.setRXGain( 1.0);
phy.setFrequency( 9.14e
;
phy.setRXThresh( 3.652e-10);
phy.setCSThresh( 1.559e-11);
phy.setID( ID);
#ifdef QUEUE_NOBUFFER
queue.NoBuffer=true;
#else
queue.NoBuffer=false;
#endif
connect app.to_transport, net.from_transport;
connect net.to_transport, app.from_transport;
connect net.to_mac, queue.in;
connect queue.out, mac.from_network;
connect mac.to_network_ack, queue.next;
connect queue.ack, net.from_mac_ack;
connect mac.to_network_data, net.from_mac_data ;
//connect mac.to_network_data, net.from_mac_data ;
//connect mac.to_network_ack, net.from_mac_ack;
//connect net.to_mac, mac.from_network;
connect mac.to_phy, phy.from_mac;
connect phy.to_mac, mac.from_phy;
connect phy.to_power_switch, pm.switch_state;
connect pm.to_battery_query, battery.query_in;
connect pm.to_battery_power, battery.power_in;
connect phy.to_channel, to_channel_packet;
connect mob.pos_out, to_channel_pos;
connect from_channel, phy.from_channel;
connect pm.from_pm_node_up, net.from_pm_node_up;
SrcOrDst=false;
}
component RoutingSim : public CostSimEng
{
public:
void Start();
void Stop();
double MaxX, MaxY;
int NumNodes;
int NumSourceNodes;
int NumConnections;
int PacketSize;
double Interval;
double ActivePercent;
SensorNode[] nodes;
SimpleChannel < mac_packet_t > channel;
void Setup();
};
void RoutingSim :: Start()
{
}
void RoutingSim :: Stop()
{
int i,sent,recv,recv_data;
double delay;
double hop;
for(sent=recv=i=0,delay=0.0;i<NumNodes;i++)
{
sent+=nodes[i].app.SentPackets;
recv+=nodes[i].app.RecvPackets;
delay+=nodes[i].app.TotalDelay;
}
printf("APP -- packets sent: %d, received: %d, success rate: %.3f, delay: %.3f\n",
sent,recv,(double)recv/sent,delay/recv);
recv_data=recv;
hop=0.0;
for(sent=recv=i=0;i<NumNodes;i++)
{
sent+=nodes[i].net.SentPackets;
recv+=nodes[i].net.RecvPackets;
hop+=nodes[i].net.TotalHop;
}
printf("%f %d\n", hop, recv_data);
printf("NET -- packets sent: %d, received: %d, average hop: %.3f\n",sent,recv,hop/recv_data);
for(sent=recv=i=0;i<NumNodes;i++)
{
sent+=nodes[i].mac.SentPackets;
recv+=nodes[i].mac.RecvPackets;
}
printf("MAC -- packets sent: %d, received: %d\n",sent,recv);
}
void RoutingSim :: Setup()
{
int i,j;
nodes.SetSize(NumNodes);
for(i=0;i<NumNodes;i++)
{
nodes[i].MaxX=MaxX;
nodes[i].MaxY=MaxY;
nodes[i].MyEtherAddr=i;
nodes[i].ID=i;
nodes[i].Setup(); // don't forget to call this function for each sensor node
}
nodes[0].mob.setVisualizer( Visualizer::instantiate());
channel.setNumNodes( NumNodes);
channel.setDumpPackets( false);
channel.setCSThresh( nodes[0].phy.getCSThresh());
channel.setRXThresh( nodes[0].phy.getRXThresh());
channel.useFreeSpace();
channel.setWaveLength( speed_of_light/nodes[0].phy.getFrequency());
channel.setX( MaxX);
channel.setY( MaxY);
channel.setGridEnabled( false);
channel.setMaxTXPower( nodes[0].phy.getTXPower());
channel.Setup();
for(i=0;i<NumNodes;i++)
{
connect nodes[i].to_channel_packet,channel.from_phy;
connect nodes[i].to_channel_pos,channel.pos_in;
connect channel.to_phy[i],nodes[i].from_channel ;
}
int src,dst;
for(i=0;i<NumSourceNodes;i++)
{
for(j=0;j<NumConnections;j++)
{
double dx,dy;
do
{
src=Random(NumNodes);
dst=Random(NumNodes);
dx=nodes[src].mob.getX() - nodes[dst].mob.getX();
dy=nodes[src].mob.getY() - nodes[dst].mob.getY();
}while(src==dst|| (dx*dx+dy*dy)<MaxX*MaxY/4);
nodes[src].SrcOrDst=true;
nodes[dst].SrcOrDst=true;
nodes[src].app.Connections.push_back(
make_triple(ether_addr_t(dst),Random(PacketSize)+P acketSize/2,
Random(Interval)+Interval/2));
nodes[dst].app.Connections.push_back(
make_triple(ether_addr_t(src),Random(PacketSize)+P acketSize/2,
Random(Interval)+Interval/2));
}
}
for(i=0;i<NumNodes;i++)
{
nodes[i].pm.BeginTime=0.0;
nodes[i].pm.FinishTime=StopTime();
if( nodes[i].SrcOrDst == true)
nodes[i].pm.failureStats( 0.0);
else
nodes[i].pm.failureStats( (double) 100.0 * i/ NumNodes, 100.0,
ActivePercent);
}
return;
}
It is given :-
To compile the program, enter:
* ../../bin/cxx sim_routing.cc
g++ -Wall -o sim_routing sim_routing.cxx
* To run the simulation, simply type in:
sim_routing [StopTime] [NumNodes] [MaxX] [NumSourceNodes] [ActivePercent] [PacketSize] [Interval]
- 04-14-2011 #6Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
compilation error in cygwin
I had fix these errors by using following commands
../../bin/cxx sim_routing.cc
g++ -Wall -o sim_routing sim_routing.cxx
but now it shows following errors
../../common/priority_q.h/ : in member function bool "guarded Queue"<ITEM> ::validate<const char*>;
error : their is no 'strcat' that depends on template parameter so declaration of strcat must be available


Reply With Quote
