C Linker Error Undefined Reference
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more linker error undefined reference to winmain@16' dev c++ about Stack Overflow the company Business Learn more about hiring developers or posting
Linker Error Undefined Reference To Function In C
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Linker Error Undefined Reference To __chkstk_ms'
Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What causes the error “undefined reference to (some function)”? [duplicate] up
Linker Error Undefined Reference To Wsastartup@8'
vote 7 down vote favorite This question already has an answer here: What is an undefined reference/unresolved external symbol error and how do I fix it? 25 answers I get the error: main.o(.text+0x1ed): In function `main': : undefined reference to `avergecolumns' collect2: ld returned 1 exit status when I gcc *.o. I'm not quite sure what causes this error. Other posters have explained it as the function is not linker error undefined reference to __cpu_features_init found or the function is empty. If someone could clarify or refine, it would be greaty appreciated! Here is my function's code(I'm trying to calculate the average of the column in 2D arrays): #include "my.h" void averagecolumns (int x, int y, int** a) { int i; int j; float sum; float colAvg; sum = 0; colAvg = 0; printf("i. The column averages are: \n"); for(i = 0; i < x; i++) { for(j = 0; j < y; j++) { sum += a[i][j]; colAvg = sum / (float)x; } printf("Column: %3d, Average: %6.2f", j, colAvg); sum = 0; colAvg = 0; } The relavent parts of main are: #include "my.h" int main (int argc, char* argv[]) { int** a; float** colAvg; int ROWS; int COLS; int i; int j; int** table; FILE* fpmyfile; int closeResult; .... printme (ROWS, COLS, a); // call functions a - j oddvalues (ROWS, COLS, a); oddlocations (ROWS, COLS, a); countoddrows (ROWS, COLS, a); addrows (ROWS, COLS, a); findfirstsmall (ROWS, COLS, a); findlastlarge (ROWS,COLS, a); addcolumns (ROWS, COLS, a); avergecolumns (ROWS, COLS, a); .... } Also, is this a linker or a compile error (I wasn't sure which tag to add). c linker-error share|improve this question edited Nov 6
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more undefined reference error in c about Stack Overflow the company Business Learn more about hiring developers or posting undefined reference to function c++ ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack undefined reference to static library function Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Linker Error C++ “undefined reference ” [duplicate] up vote 8 down http://stackoverflow.com/questions/8024440/what-causes-the-error-undefined-reference-to-some-function vote favorite 2 Possible Duplicate: What is an undefined reference/unresolved external symbol error and how do I fix it? Trying to compile my program via g++ -o prog1 main.cpp -std=c++0x I get the error: /tmp/cc1pZ8OM.o: In function `main': main.cpp:(.text+0x148): undefined reference to `Hash::insert(int, char)' collect2: error: ld returned 1 exit status main.cpp #include
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company http://stackoverflow.com/questions/14871679/linker-error-undefined-reference-to-print Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just http://www.cprogramming.com/tutorial/compiler_linker_errors.html like you, helping each other. Join them; it only takes a minute: Sign up Linker error undefined reference to `print' up vote 1 down vote favorite I have a program named "main.c" containing the main() that calls undefined reference a function whose definition is available in other source file named "nim.c". I made a header file named "nim.h" that contains the prototype of the required method. This header file "nim.h" is already included it in my "main.c". I am putting up all the files that are part of this program. //main.c #include
Practice Problems Quizzes Resources Source Code Source Code Snippets C and C++ Tips Finding a Job References Function Reference Syntax Reference Programming FAQ Getting Help Message Board Email About Us Dealing with Compiler Errors - Surviving the Compilation Process By Alex Allain It's your first C (or C++) program--it's not that long, and you're about to compile it. You hit compile (or enter the build command) and wait. Your compiler spits out fifty lines of text. You pick out words like "warning and "error". Does that mean it worked? you wonder. You look for the resulting executable. Nothing. Damn, you think, I guess I have to figure out what this all means... The Types of Compilation Errors First, let's distinguish between the types of errors: most compilers will give three types of compile-time alerts: compiler warnings, compiler errors, and linker errors. Although you don't want to ignore them, compiler warnings aren't something severe enough to actually keep your program from compiling. Usually, compiler warnings are an indication that something might go wrong at runtime. How can the compiler know this at all? You might be making a typical mistake that the compiler knows about. A common example is using the assignment operator ('=') instead of the equality operator ('==') inside an if statement. Your compiler may also warn you about using variables that haven't been initialized and other similar mistakes. Generally, you can set the warning level of your compiler--I like to keep it at its highest level so that my compiler warnings don't turn in to bugs in the running program ('runtime bugs'). Nevertheless, compiler warnings aren't going to stop you from getting your program working (unless you tell your compiler to treat warnings as errors), so they're probably a bit less frustrating than errors. Errors are conditions that prevent the compiler from completing the compilation of your files.