C :: Redefinition Errors In When Compiling
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
ADVERTISEMENT
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
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
Mar 28, 2013
I've written a simple program that output's my name, course, and a time date stamp.
Having researched the code to do so, I've used the includes for both the ctime and time.h libraries.
I leveraged localtime_s and asctime_s to actually convert to string etc., and the program runs fine when I step through it in Visual Studio.
However, we're working with CGI and this program will ultimately be called up from the cgi-bin directory of a web server. The first thing that needs to be done after copying it to the webserver is to compile it. That's where my problem occurs.
Using the console command: g++ lab5a.cpp -o lab5a.exe the file is supposed to compile and be converted to a .exe.
However, instead I receive errors:
localtime_s was not declared in this scope
asctime_s was not declared in this scope
I "believe" it's because of the included libraries, but not sure.
They are:
HTML Code:
#include <iostream>
#include <ctime>
#include <time.h>
Here's the actual timestamp block of code:
HTML Code:
//Begin date and time instructions
time_t curTime;
struct tm locTime;
const int TimeStrLen = 26;
[Code] ....
Of course, I go on to error check and complete the block, but you get the picture.
View 5 Replies
View Related
Jan 22, 2013
I am trying to make a poker scoring code and am struggling a bit with the 'picture cards'. The user inputs the handfor example 3c 7d 9h js ad.I have worked out nearly all of the source code, except straights that include jack queen king ace.Is there anyway that when a user types in J the code will recognize it as 11, then queen as 12, etc etc. So from there I could still use the same code I have already made.Here is the part of my code that works out the straight.
Code:
#include<stdio.h>
int main(void)
{ int c;
int n;
int count1[127] = {0};
int count2[127] = {0};
}
[code]...
View 5 Replies
View Related
Jun 17, 2014
I am having this error where it declares two of the same identifier, but I cannot figure it out.
Error C237 states:
The identifier is already declared.
Example
// C2371.cpp
int main() {
int i;
float i; // C2371, redefinition
float f; // OK
}
Though in my code I cannot find a redefinition anywhere.
texturemanager.h
#ifndef TEXTUREMANAGER_H
#define TEXTUREMANAGER_H
#include <SDL.h>
#include <SDL_image.h>
#include <iostream>
#include <string>
[Code] ....
My complete Error states as this:
Error3error C2371: 'TextureManager::load' : redefinition; different basic type line:4
Error2error C2556: 'TextureManager TextureManager::load(std::string,int,int,int,int,SDL_Renderer
*,SDL_RendererFlip)' : overloaded function differs only by return type from 'bool TextureManager::load(std::string,int,int,int,int,SDL_Renderer *,SDL_RendererFlip)' line: 4
Error1error C2628: 'TextureManager' followed by 'bool' is illegal (did you forget a ';'?) line:3
IDE: Visual Studio 2012
View 4 Replies
View Related
Jul 25, 2014
I'm having a constant error in my DLL regarding one simple function: I get the error:
double *(double)' differs in levels of indirection from 'double (double)'
The declaration is:
extern EXP32 double *FAR PASCAL_CONV utc2tdb(double jd);
What can be the problem?
View 1 Replies
View Related
Mar 20, 2012
I'm taking an intro to c++ class and during an exercise I ran into multiple errors that are out of my knowledge to fix. The rest of the class is using Visual and that is all the instructor knows so i'm in my own figuring out Xcode. Basically I wrote the same program twice but one has a different struct and I get all sorts of errors with it. understand what the errors are and why they occurred.
The working program is this:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
struct point {
public:
double x1,y1;
double x2,y2;
[code]....
This program does not compile and I get the following errors:
stl_iterator_base_types.h
1) Symantic Issue
No type named 'value_type' in 'myPoint'
2) Symantic Issue
No type named 'iterator_category in 'myPoint'
3) Symantic Issue
No type named 'difference_type' in 'myPoint'
4) Symantic Issue
No type named 'pointer' in 'myPoint'
5) Symantic Issue
No type named 'reference' in 'myPoint'
Why does one work and the other doesn't!?
View 14 Replies
View Related
Apr 30, 2015
I'm compiling some open source code (originally written for Linux / gcc) which uses the following line to determine if a particular section is being compiled for an x86 processor:-
Code:
#if ( defined(__x86_64__) || defined(__i386__) )
neither of those seems to be defined by my ageing compiler (VC++ 8.0). What would be the equivalent for building with VC8 ?
View 6 Replies
View Related
Feb 5, 2013
I've a problem compiling my makefile. The additional files are enclosed.
the error I get:
$make ./main
gcc -ggdb main.c
/tmp/ccPIxwjP.o: In function `main':
/home/ilan/Embedded_linux/Lesson-2-Makefiles/lesson-2.1/main.c:6: undefined reference to `func1'
/home/ilan/Embedded_linux/Lesson-2-Makefiles/lesson-2.1/main.c:7: undefined reference to `func2'
collect2: error: ld returned 1 exit status
make: *** [main.o] Error 1
$
Code:
my make file:
main : main.o file1.o file2.o
gcc -ggdb main.o file1.o file2.o -o gdb-main
main.o : main.c file1.h file2.h
[Code] .....
View 4 Replies
View Related
Sep 22, 2014
I want to use two separate files in 1 program, but cannot get it to work. I don't know if it's my files or the compiling thats wrong. I have never used 2 files in my programs so far. Only used #include <stdio.h>.
Here are my files:
extern_static.c Code: extern int i;
int main(void)
{
[Code]....
View 10 Replies
View Related
Mar 18, 2014
Code:
#include<stdio.h>
#include<strings.h>
main() {
} struct employ {
char name[50];
float age ;
[Code] .....
View 2 Replies
View Related
Mar 6, 2013
Code:
/* Demonstrates using the gets() return value. */
#include <stdio.h>
/* Declare a character array to hold input, and a pointer. */
char input[257], *ptr;
[Code]....
I just got this from the book that I am using and it is for testing for input of a blank line and readers are being warned in using this format (line 18):
Code: while ( (*ptr = gets(input)) != NULL)
What is the correct syntax if a gcc compiler is to be used?
View 8 Replies
View Related
Mar 28, 2013
I have a FTP server, client program and thus I can easily transfer files, however what I want is to modify the program such that server receives a c/c++ file, compiles the output, and sends a text file back to the client containing the output. The program should also take note that errors are also transferred.
View 9 Replies
View Related
Jun 25, 2014
I'm working for implementing the binary search tree .Everything looks fine but on compiling the code , the program got crashed .
code :
#include<iostream>
#include<stdio.h>
using namespace std;
[Code]......
View 1 Replies
View Related
Oct 21, 2014
I am trying to compile two programs using the same header file and definitions. makefile part to make this work.
================================
My headerfile looks like this:
#ifdef ONE
void hello(int s);
#else
[Code]....
How can I include the flag -DONE in my makefile so that
it includes void hello(int s); for "one" and
int pin;
int verification(char* name);
for "two"
View 2 Replies
View Related
Sep 7, 2012
In a rather large codebase, there is a set of recurring calls to a couple vararg functions (mainly for logging)
Code: logthis(foo, bar(), somefunction(parameter1,parameter2), somethingelse);
The number of parameters to this function is variable It has all types of variables, function calls, etc.
The code has thousands of these lines
There is now a need for a special version of the compile that will remove a lot of the code, among others is the logging.
Can I somehow #define the "logthis" name into something that'll remove all actual calls to the code. including the actual parameters/expressions to the call.
I can't afford to add #ifdef/#endif around each of the calls because there are too many of them, and because that'll cause some undisired side effects in our code conformance tests.
Code: #define logthis __noop
comes close, that removes the call, but it still causes the compiler to evaluate and validate all the parameters to the logthis function, which doesn't work because in this case, removing the logging headers also removes other members of the class that get used as part of the parameters to logthis()
if I could define logthis into // resulting in all the rest of the line being comments, but that doesn't work.
Preferably I'd like something to be portable, but I'll take a solution that only works on visual studio as well.
View 6 Replies
View Related
Dec 24, 2014
I'm trying to compile a library for use with PoLabs Pokeys 56U USB device (PoKeys56U) on Linux Mint 17 64-bit.
I'm using the information from here - New cross-platform library for all PoKeys devices - MyPokeys
When I run
sudo make -f Makefile.noqmake install
I get the following errors;In file included from PoKeysLibCore.c:22:0:
PoKeysLib.h:38:28: error: conflicting types for "int64_t"
typedef long long int64_t;
^
In file included from /usr/include/stdlib.h:314:0,
from PoKeysLibCore.c:21:
[Code] ....
Here is the offending code from the header file;
Code:
#ifndef __POKEYSLIB
#define __POKEYSLIB
#define USE_STD_INT
#ifdef USE_STD_INT
#include "stdint.h"
[Code] ....
View 12 Replies
View Related
Oct 26, 2013
I'm creating a small command line game in C. I have never done anything cross platforms, but this is small enough (so far) that it might not be too bad.
When I am done, I'm not sure how it will be distributed: Either I will just send people the C files and say "compile on your system with these options", or I will just have executables for various systems. Probably Windows 7/8, Ubuntu, CentOS, and whatever I can find to test on.
I right now I'm testing/developing on Windows 7 using MinGW. So my questions are: while I'm developing, how should I be compiling/testing it?
View 4 Replies
View Related
Jul 7, 2014
While I was trying to compile simple c program, I saw this virus alert:
Win64:Evo-gen [Susp]
View 9 Replies
View Related
Mar 23, 2013
I'm working on my program that takes input of the employees' first and last name, their payrate, their deferred from check and also the amount of hours they have worked which then the gross is calculated and also the taxes are calculated by an external function. In the program design it is necessary to put arrays which I have done, but when i compile I receive warning messages
Code: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'double'
Warning: format '%f' expects a matching 'double' argument [-Wformat] which I believe is causing my program to just give me garbage when I run it. What do those warnings mean?
Code:
/* Name: Arturo
Date: 03/22/13
Purpose: To learn
*/
extern void calculate taxes(float gross,float deferred, float *ft, float *st, float ........i);
void ovtHrs(float *hrs_wrk, float *ovt_hrs, float hrs, float *gross, float payrate);
void netPay(float gross, float deferred, float ft, float st, float ssi, float *net);
[Code] .....
View 9 Replies
View Related
Oct 24, 2014
Problem: When I add a new variable to complete my program, it crashes. I have tried tracing where the problem is but it leads to adding new variables
Purpose of program: Every 2 lines of the input file belong to 1 participant. The line with decimals include times a person has run miles. While the second line of each participant are integers that indicate the best sets from workouts the participant had done.
so an example of the output
Participant #1
Cardio Workouts:
Best Time:
Worst Time:
Average Time:
Weight Workouts:
Most Sets:
Least Sets:
Average Sets:
Participant #2
...
Why my program is crashing
#include <stdio.h>
int main () {
// Stats Col0=BestTime Col1=WorstTime col2=mostSets col3=leastSets Col4=Average_time Col5=Average_sets
float chart[20][12], stats[10][6], best_time=100, worst_time=0, most_sets=0, least_sets=100, avg_time, avg_sets, sum;
int i, j;
int p=0;
[Code] .....
Attached File(s)
input1.txt (817bytes)
View 1 Replies
View Related
Nov 20, 2014
#include <iostream>
using namespace std;
int main() {
[Code].....
View 2 Replies
View Related
May 10, 2014
I am working on a small project which contains three files
1. MainTest.cpp
2. CashRegister.h
3. CashRegister.cpp
I have done everything that suppose to be done but still I am getting an error and can not execute the program....
Code:
// MainTest.cpp
#include <iomanip>
using std::setw;
using std::left;
#include <iostream>
using std::cout;
[Code] ....
View 14 Replies
View Related
Dec 6, 2014
I am working on a school project and am stuck in the debugging. I am compiling with g++ and am using c++11.
Error message
In file included from /usr/include/c++/4.7/algorithm:63:0,
from date.h:7,
from date.cpp:1,
from schedule.h:1,
from schedule.cpp:1,
from date_driver.cpp:1:
[Code] ....
Here are my overloaded operators for my date class.
bool Date :: operator == (Date otherDate){
if (((otherDate.getDay () == getDay ()) && (otherDate.getMonth () == getMonth ())) && (otherDate.getYear () == getYear ()))
[Code] .....
View 1 Replies
View Related
Mar 6, 2013
I have been trying to compile a static version of the boost libraries, however when I try to launch the program it says fatal error LNK1104: cannot open file 'libboost_serialization-vc100-mt-s-1_53.lib'
I have checked in the boost/stage/lib folder and that file is not there. I compiled boost with b2 link=static yet the file still isn't there.
View 3 Replies
View Related