C++ :: Seg Fault Run Errors
Mar 25, 2014
identify the reason why I am getting a seg fault run error? I hate to bother but I've been trying for several days now to fix the same function.
class adjacencyList {
public:
explicit adjacencyList(int size);
void buildGraph(Edge inEdge);
void print();
[code].....
View 6 Replies
ADVERTISEMENT
Sep 8, 2013
have several linux header files included and when I compile my program I get the below errors..Am I NOT supposed to use some of these headers? Source is below as well.Looking through the headers mentioned in these errors, it's looking like stuff really is defined in multiple places...
Code:
codeblox@Lubuntu-pc:~/Programming/C/Network/MITM/src$ gcc -g -o mitm *.c
In file included from mitm.h:12:0,
from create_raw.c:1:
/usr/include/netpacket/packet.h:22:8: error: redefinition of ‘struct sockaddr_ll’
In file included from /usr/include/linux/netdevice.h:30:0,
from /usr/include/linux/if_arp.h:26,
from mitm.h:10,
from create_raw.c:1:
}
[code]....
View 5 Replies
View Related
Feb 17, 2013
I've included <cstddef> into a project of mine in favour of <stddef.h>. When I tried to compile my project, I get 50+ errors stating that types such as "::size_t", "::div_t" and "::abort( )" have not been declared even though <cstddef> includes <stddef.h>.
I've tried searching both the global namespace and the standard namespace, but neither way works. At this moment in time, I don't have any compiler options enabled that may affect the way identifiers are defined, C++11 isn't enabled (which doesn't affect the <cstddef> header anyway), the project is a C++ project, and I've tried using the plain old <stddef.h> header, but the problems still persist.
I'm using GNU's C++ compiler ("__GNUG__" is defined).
View 3 Replies
View Related
Feb 15, 2013
I am new to C++ language and I am still learning.I'm doing basic stuff to better understand dynamic memory. I was wondering why I keep getting memory issues.*/
#define SIZE 15
class word {
char* str;
public:
[code]....
View 1 Replies
View Related
Dec 31, 2014
At this stage I will obtain Dimensions A, B & C. But after this before I do the pythagoras equation using the data I want it checked over. I think I've done this here but I'm not sure. I want it to report the message "Invalid Data" if Dimension A is not the longest.
cout << "Enter Dimension A:-";
cin >> DimA;
cout << "Enter Dimension B:-";
cin >> DimB;
cout << "Enter Dimension C:-";
cin >> DimC;
if (DimA >= DimB, DimC)
cout << endl << "Invalid Data";
View 15 Replies
View Related
Mar 22, 2014
# include <iostream>
# include <cstring>
#include <iomanip>
#include <cmath>
using namespace std;
class Course
// Creating the class Course
[Code] ....
Errors: Warning1warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
[Code] .....
I have to create an Array of type Course and then fill its member dats using various member functions. Those errors are caused by some Constructor defect, which I dont really know what it is.
View 2 Replies
View Related
Feb 1, 2015
I am currently just trying to update a record in a SQL database.I can add a record and delete a record just fine but when I go to update I get no errors but it just doesn't update.
Here is what I have and done coding for hours trial and error
private void btnAddProd_Click(object sender, RoutedEventArgs e)
{//validate method // product = new Product(txtProductName.Text, Convert.ToDecimal(txtProductCost.Text), txtProductType.Text);
product = new Product();
MakeProduct(product);
if(modify) {
Product theOneAndOnly = new Product();
[Code] ....
View 1 Replies
View Related
Mar 21, 2014
I'm currently messing around with geolocation and have this Windows App I'm working on. There is no errors or warnings when I run it, but it does not work. I click my Enable GPS button and nada, nothing, zilch. This isn't a important project or anything just a learning experience for myself.
This is my C# portion if you need me to post the XAML side also I can do that as well.
using System;
using System.Collections.Generic;
using System.IO;
[Code].....
View 5 Replies
View Related
Dec 17, 2014
i use cygwin and i have a program that was returning an error saying "undefined reference" and i figured out that i misspelled a word. how can i search for the misspelling in the input mode, if ive just completed a very large program and dont want to scroll through possibly 300+ lines of input? im not totally out the loop, but i know i can "vim program.cpp" to open the program, but before clicking "i" to actually edit, there must be a way to search a word
View 9 Replies
View Related
Sep 7, 2012
I am forced to have the deceleration of a class template in the .h file.
See here: [URL] ....
This works perfectly fine, as long as i #inlcude the header file only in ONE .cpp file.
The moment i #inlude it in several .cpp files, i get LNK2005 already-defined errors.
a.obj : error LNK2005: "public: unsigned int * __thiscall theclass::themthod(void)" (?xxx@theclass@@QAEPAIXZ) already defined in b.obj
I would have assumed inclusion guards can protect me from this, but wrong.
View 2 Replies
View Related
Oct 23, 2013
I am writing a program in C. The following is an extract from my code:
Code:
enum coin_types{
FIVE_CENTS=5,
TEN_CENTS=10,
TWENTY_CENTS=20,
FIFTY_CENTS=50,
ONE_DOLLAR=100,
TWO_DOLLARS=200
[Code] .....
I'm getting the following errors:
For: new = new_coins_data_line(line);
"Incompatible types in assignment"
For: return newdata;
"Incompatible types in return"
There seem to be problems with my variables and perhaps it is related to the type 'struct coin' which has an enumerated type within it.
View 5 Replies
View Related
Nov 19, 2013
I wrote a class to manage pointers better (because I am making a large program and don't want to call a constructor on somthing that was already deleted... etc...), but I am getting some compiler errors. I'm not sure what to do.
here is the class prototype:
template<typename type>
class pointer_class{
public:
pointer_class() : dat(NULL), del(false) {}
explicit pointer_class(const pointer_class<type>& d) : dat(NULL),
[Code].....
View 19 Replies
View Related
Mar 30, 2013
I've recently downloaded the original DOOM source code from id Software's GitHub page. I decided it would be fun to port it to Windows 7. I created a new Win32 application within Microsoft Visual Studio 2010 Professional, added all the DOOM files to the project, and hit compile. I got a ton of odd errors, so I switched the project from C++ to C and hit compile again. I got a few more errors, which I've mostly resolved (they come from the fact that the DOOM code I downloaded was written for Linux in 1993), and an error on nearly every symbol in cmath. The errors are C2059 and C2061. A little bit of digging around online revealed that these errors come from including cmath in a C project. However, I can find no reference to cmath in my code files.
A little more digging around online revealed that certain C++ files, like fstream, include cmath. I removed all of those that I could, but to no avail. How I can get rid of these errors?
All the code in this project so far can be found at [URL] ....
View 3 Replies
View Related
Feb 13, 2013
When i build this program i get no errors, however a message appears saying vector subscript out of range. What does this mean and what can i do to mkae my program work
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <cstring>
#include <time.h>
#include <vector>
using namespace std;
[Code] .....
View 19 Replies
View Related
Feb 17, 2013
I have this TicTacToe program that needs finishing. All the code is finished, but I'm getting runtime errors. It is printing out junk values from my array when they should be empty.
//Player.h
#include <string>
#include "TTT.h"
using namespace std;
class Player {
[Code] .....
//This is a screenshot of the output. [URL] .....
View 5 Replies
View Related
Oct 9, 2013
Ive been writing this code all day and these errors have been killing.
Instructions:
Car Class:
Write a class named Car that has the following:
year. An int that holds the cars model year.
make. A string object that holds the make of car.
speed. An int that holds the cars current speed.
In addition, the class should have the following member functions.
Constructor. The constructor should accept the car's year and make as arguments and assign these values to a object's year and make member variables. The constructor should initialize the speed member variable to 0.
Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's year, make, and speed member variables.
accelerate. the accelerate function should add 5 to the speed member variable each time it is called.
brake. The brake function should subtract 5 from the speed member variable each time it is called.
Demonstrate the class in a program that creates a Car object, and then calls accelerate function five times. After each call to the accelerate function, get the current speed of the car and display it. The, call the brake function five times. After each call to the brake function, get the current speed of the car and display it.
Errors: error C2061: syntax error : identifier 'stringm'
error C2533: 'Car::{ctor}' : constructors not allowed a return type
error C2511: 'Car::Car(int)' : overloaded member function not found in 'Car'
see declaration of 'Car'
fatal error C1903: unable to recover from previous error(s); stopping compilation
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
[Code].....
View 2 Replies
View Related
Apr 10, 2013
I'm doing a homework assignment where I have to calculate monthly interest from a starting balance. I've pulled several sections of the code from various parts of the book. So my problem may be that I'm not combining them correctly.
I'm getting the following error:
Error1error LNK2019: unresolved external symbol "public: __thiscall SavingsAccount::SavingsAccount(void)" (??0SavingsAccount@@QAE@XZ) referenced in function _main
The ios flags are new to me and that may be part of the problem. As soon as I can get a working program, I'm going to make the starting balance and interest rate user inputs. But I get seem to get past this error.
// Savings.cpp
// Chapter 10_Problem 10.7
#include <iostream>
[Code].....
View 12 Replies
View Related
Nov 17, 2014
I have to find at least 5 errors in the following class template. I have found three and it now compiles, here is the template
#include <map>
#include <utility>
template <class T> class foo{
public :
foo(T bar1, T bar2){
_bar1.push_back(bar1);
_bar2.insert( std::pair<T,T>(bar1,bar2) );
[Code] ....
The errors I believe I have found are as follows: the vector library has not been added, the map requires two type arguments rather than one and the object which is created in main doesn't pass any values to the constructor. I fixed all of these errors and the code now compiles without errors, however the problem asks for five.
View 1 Replies
View Related
Apr 21, 2014
I've just started coding a "Mathematics" library for my own, just to practice some OOP concepts, but sadly I didn't get too far with it before the first errors appeared. That is, I created a Matrix.H and Matrix.CPP file (separate class) in a "Linear Algebra" folder.
However, when I run the code I get the following (linker?) error:
#include <iostream>
#include "Matrix.h"
using namespace std;
int main() {
Matrix<int> A(7,5);
int row[] = {5, 10, 9, 11, -5};
[Code] ....
I am using Visual Studio 2012 (stating this in case it could be related to the reason for which I get the error).
View 2 Replies
View Related
Mar 22, 2014
what my compiling errors mean, and what I should do to fix them: The following is my header & Implementation files. Note, the purpose of this class is a built in Array.
Header File:
#ifndef ARRAY_H
#define ARRAY_H
#include <iostream>
[Code].....
View 5 Replies
View Related
May 22, 2014
I'm currently just trying C++ with SFML. So I've installe SFML 2.0 for Visual C++ 2010 Express 64 bit, and I get an error while trying to run the debug of my code.
//Libraries
#include <SFML/Graphics.hpp>
#include <iostream>
int main() {
sf::RenderWindow window(sf::VideoMode(1280, 720),"SFML Game1");
return 0;
}
And this is the result I'm getting when trying to run it
1
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
View 3 Replies
View Related
Mar 8, 2014
What am I doing wrong with static members and methods here?
compiler errors:
1>test.obj : error LNK2005: "private: static int Test::count" (?count@Test@@0HA) already defined in main.obj
1>c:usersjamesdocumentsvisual studio 2013Projectsstatic_testReleasestatic_test.exe : fatal error LNK1169: one or more multiply defined symbols found
test.h
#ifndef TEST_H_
#define TEST_H_
class Test {
[code]....
View 4 Replies
View Related
May 8, 2014
Im making a program on eclipse(linux), and getting a bunch of errors...
type string couldn't be resolved
symbol std couldn't be resolved
unresolved inclusion <iostream>
invalid preprocessing directive #include
etc...
know whats going on? I'm pretty sure it must be something with configuration..?
View 9 Replies
View Related
Jan 31, 2014
I changed the name of my Invoice class to 'Application' and then it generated errors such as follows
Error9'Invoice.Invoice' does not contain a definition for 'Documents' and no extension method 'Documents' accepting a first argument of type 'Invoice.Invoice' could be found (are you missing a using directive or an assembly reference?)c:userskeildocumentsvisual studio 2013projectsinvoiceinvoicewritefile.cs1840Invoice
Error3'Invoice.Invoice' does not contain a definition for 'Run'C:UsersKeilDocumentsVisual Studio 2013ProjectsInvoiceInvoiceProgram.cs1921Invoice
I have added my classes here, lso I have added the sln to this post.
using System;
using System.Collections.Generic;
using System.ComponentModel;
[Code].....
View 5 Replies
View Related
Nov 18, 2014
I have to find at least 5 errors in the following class template. I have found three and it now compiles, here is the template
#include <map>
#include <utility>
template <class T> class foo{
public :
[Code]....
The errors I believe I have found are as follows: the vector library has not been added, the map requires two type arguments rather than one and the object which is created in main doesn't pass any values to the constructor. I fixed all of these errors and the code now compiles without errors, however the problem asks for five.
View 2 Replies
View Related
Jan 14, 2015
This is a file called namespaces.h
#pragma once
namespace mycode {
void foo();
}
This is a file called source.cpp
#include <iostream>
#include "namespaces.h"
namespace mycode {
void foo() {
std::cout << "foo() called in the mycode namespace" << std::endl;
}
}
When I try to run this code i keep getting these errors;
Error1error LNK2019: unresolved external symbol "void __cdecl mycode::foo(void)" (?foo@mycode@@YAXXZ) referenced in function _mainC:UsersHomeDesktopgameDevWin32Project1Win32Project1Source1.objWin32Project1
Error2error LNK1120: 1 unresolved externalsC:UsersHomeDesktopgameDevWin32Project1DebugWin32Project1.exeWin32Project1
this is a win32 console application, like the books says, the book i am working from that is.
View 11 Replies
View Related