Search Results

Search found 2237 results on 90 pages for 'msp430 gcc'.

Page 6/90 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • gcc does not generate debugger info when using -g, -ggdb, -g3, or -ggdb3

    - by CJJ
    I'm using GCC 4.4.1 and GDB 7.0-ubuntu on Ubuntu 9.10. However, GCC won't generate debugger info when using any of the following switches: -g, -g3, -ggdb, or -ggdb3. So when I run the program with GDB, its as if there was no debugger information generated. I have created very simple test source files in a new, empty folder. Here is one example: #include <stdlib.h> #include <stdio.h> int main (int argc, char **argv) { char msg[4]; // allocate 4 bytes on the stack strcpy (msg, "hello world"); // overflow printf ("%s\n", msg); return 0; }

    Read the article

  • Demystifying gcc under lpthreads

    - by Berkay
    in these i'm playing with thread library and trying to implement some functions. One of the tutorial says that to run the program use : gcc -lpthread -lrt -lc -lm project1.c scheduler.c -o out first of all i need deep understanding of what is gcc doing in each line, lpthread is used for what? what are the contributions of lrt -lc -lm ? project1.c and scheduler.c is compiled together so what should i understand? i checked the code and any of them not included in project1.c or scheduler.c. as an output clearly it gives "out". secondly the author states that to run the program you have to use ./out number filename (For example, ./out 2 sample.txt) To make these clear as far as i understand the main function gets number and sample.txt as an input.(?) thanks for your answers and making me clear.

    Read the article

  • strod() and sprintf() inconsistency under GCC and MSVC

    - by Dmitry Sapelnikov
    I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions: strtod() (string-to-double conversion) ? sprintf (when used for outputting double-precision floating point numbers) -- their GCC and MSVC versions return different results. I'm looking for a well-tested cross-platform open-source implementation of those functions, or just for a pair of functions that would correctly and consistently convert double to string and back. I've already tried the clib GCC implementation, but the code is too long and too dependent on other source files, so I expect the adaptation to be difficult. What implementations of string-to-double and double-to-string functions would you recommend?

    Read the article

  • C++0x regex in GCC

    - by rwallace
    The following code: #include <regex> using namespace std; (snippage) regex_search(s, m, re); works in Microsoft C++, but GCC 4.4.3 gives the following error message: /usr/include/c++/4.4/tr1_impl/regex:2255: warning: inline function ‘bool std::regex_search(_Bi_iter, _Bi_iter, std::match_results<_Bi_iter, _Allocator&, const std::basic_regex<_Ch_type, _Rx_traits&, std::regex_constants::match_flag_type) [with _Bi_iter = __gnu_cxx::__normal_iterator, std::allocator , _Allocator = std::allocator, std::allocator , _Ch_type = char, _Rx_traits = std::regex_traits]’ used but never defined Of course it wouldn't surprise me if regex were simply one of the C++0x features still on the to-do list for GCC, but what I'm scratching my head over is, in that case, why does it happily take the include directive, variable declarations etc. and only trip over the function call (which it even seems to understand). Is there something I'm missing?

    Read the article

  • Returning structs in registers - ARM ABI in GCC

    - by jbcreix
    Hi, In the ARM ABI documentation I come across functions defined like: __value_in_regs struct bar foo(int a, int b) { ... } but GCC(4.3.3) doesn't allow it and all I could find are references to some RealView compiler. Is there any way of doing this from GCC? I have tried -freg-struct-return but it doesn't make a difference. As it is an ABI I can't change the original programs, and returning a regular struct mangles the stack. I would rather not using assembly for this if avoidable as it isn't otherwise necessary. Thanks!

    Read the article

  • Embedding binary blobs using gcc mingw

    - by myforwik
    I am trying to embed binary blobs into an exe file. I am using mingw gcc. I make the object file like this: ld -r -b binary -o binary.o input.txt I then look objdump output to get the symbols: objdump -x binary.o And it gives symbols named: _binary_input_txt_start _binary_input_txt_end _binary_input_txt_size I then try and access them in my C program: #include <stdlib.h> #include <stdio.h> extern char _binary_input_txt_start[]; int main (int argc, char *argv[]) { char *p; p = _binary_input_txt_start; return 0; } Then I compile like this: gcc -o test.exe test.c binary.o But I always get: undefined reference to _binary_input_txt_start Does anyone know what I am doing wrong?

    Read the article

  • the problem about different treatment to __VA_ARGS__ when using VS 2008 and GCC

    - by liuliu
    I am trying to identify a problem because of an unusual usage of variadic macros. Here is the hypothetic macro: #define va(c, d, ...) c(d, __VA_ARGS__) #define var(a, b, ...) va(__VA_ARGS__, a, b) var(2, 3, printf, “%d %d %d\n”, 1); For gcc, the preprocessor will output printf("%d %d %d\n", 1, 2, 3) but for VS 2008, the output is printf, “%d %d %d\n”, 1(2, 3); I suspect the difference is caused by the different treatment to VA_ARGS, for gcc, it will first expand the expression to va(printf, "%d %d %d\n", 1, 2, 3), and treat 1, 2, 3 as the VA_ARGS for macro va. But for VS 2008, it will first treat b as VA_ARGS for macro va, and then do the expansion. Which one is correct interpretation for C99 variadic macro? or my usage falls into an undefined behavior?

    Read the article

  • gcc, UTF-8 and limits.h

    - by bobby
    My OS is Debian, my default locale is UTF-8 and my compiler is gcc. By default CHAR_BIT in limits.h is 8 which is ok for ASCII because in ASCII 1 char = 8 bits. But since I am using UTF-8, chars can be up to 32 bits which contradicts the CHAR_BIT default value of 8. If I modify CHAR_BIT to 32 in limits.h to better suit UTF-8, what do I have to do in order for this new value to come into effect ? I guess I have to recompile gcc ? Do I have to recompile the linux kernel ? What about the default installed Debian packages, will they work ?

    Read the article

  • Stack trace for C++ using gcc

    - by dimba
    We use stack traces in proprietary assert like macro to catch developer mistakes - when error is caught, stack trace is printed. I find gcc's pair backtrace()/backtrace_symbols() methods insufficient: Names are mangled No line information 1st problem can be resolved by abi::__cxa_demangle. However 2nd problem s more tough. I found replacement for backtrace_symbols(). This is better than gcc's backtrace_symbols(), since it can retrieve line numbers (if compiled with -g) and you don't need to compile with -rdynamic. Hoverer the code is GNU licenced, so IMHO I can't use it in commercial code. Any proposals?

    Read the article

  • strtod() and sprintf() inconsistency under GCC and MSVC

    - by Dmitry Sapelnikov
    I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions: strtod() - string-to-double conversion sprintf() - when used for outputting double-precision floating point numbers) Their GCC and MSVC versions return different results. I'm looking for a well-tested cross-platform open-source implementation of those functions, or just for a pair of functions that would correctly and consistently convert double to string and back. I've already tried the clib GCC implementation, but the code is too long and too dependent on other source files, so I expect the adaptation to be difficult. What implementations of string-to-double and double-to-string functions would you recommend?

    Read the article

  • gcc options for fastest code

    - by rwallace
    I'm distributing a C++ program with a makefile for the Unix version, and I'm wondering what compiler options I should use to get the fastest possible code (it falls into the category of programs that can use all the computing power they can get and still come back for more), given that I don't know in advance what hardware, operating system or gcc version the user will have, and I want above all else to make sure it at least works correctly on every major Unix-like operating system. Thus far, I have g++ -O3 -Wno-write-strings, are there any other options I should add? On Windows, the Microsoft compiler has options for things like fast calling convention and link time code generation that are worth using, are there any equivalents on gcc? (I'm assuming it will default to 64-bit on a 64-bit platform, please correct me if that's not the case.)

    Read the article

  • Recursive compilation using gcc

    - by curiousexplorer
    I am using the gcc compiler. My project source tree looks like somewhat like this test$~: tree . . |-- folder | |-- hello.cpp | `-- hello.h `-- main.cpp 1 directory, 3 files test$~: The file main.cpp contains the main() function and all the functions invoked by main.cpp lie in the directory named folder So far in all my little projects I never had to put some source code under a sub-directory. What I am looking for, in short, is some gcc command for recursive compilation in sub-directories and their subdirectories and so on... This command should be invoked from the home directory of the code project.

    Read the article

  • PHP exec not working with gcc

    - by teehoo
    I just spent a few hours pulling my hair out over this. I'm trying to get gcc to compile a file from within PHP. $command = "/usr/bin/gcc /var/www/progpad/temp/tNu7rq.c -o /var/www/progpad/temp/tNu7rq.out"; exec($command, $output, $returnVal); echo $returnVal."<br />"; //returns 1 echo json_encode($output); //returns [] I'm running this on my own ubuntu server and both /var/www/progpad/ /var/www/progpad/temp/ have chmod 777 set. If I copy and paste the command string, and paste it into the terminal it works perfectly. Also if I replace the command string with something like $command = "echo test > test.txt"; Then this has no problem creating the text file. What could I possibly be doing wrong here???

    Read the article

  • Different ways to specify libraries to gcc/g++

    - by abigagli
    I'd be curious to understand if there's any substantial difference in specifying libraries (both shared and static) to gcc/g++ in the two following ways (CC can be g++ or gcc) CC -o output_executable /path/to/my/libstatic.a /path/to/my/libshared.so source1.cpp source2.cpp ... sourceN.cpp vs CC -o output_executable -L/path/to/my/libs -lstatic -lshared source1.cpp source2.cpp ... sourceN.cpp I can only see a major difference being that passing directly the fully-specified library name would make for a greater control in choosing static or dynamic versions, but I suspect there's something else going on that can have side effects on how the executable is built or will behave at runtime, am I right? Andrea.

    Read the article

  • C99 strict aliasing rules in C++ (GCC)

    - by Checkers
    As far as I understand, GCC supports all of its C99 features in C++. But how is C99 strict aliasing handled in C++ code? I know that casting with C casts between unrelated types is not strict-aliasing-safe and may generate incorrect code, but what about C++? Since strict aliasing is not part of C++ standard (is that correct?), GCC must be specifying the semantics itself. I figure const_cast and static_cast cast between related types, hence they are safe, while reinterpret_cast can break strict aliasing rules. Is this a correct understanding?

    Read the article

  • gcc compiled binaries w/different sizes?

    - by BillTorpey
    If the same code is built at different times w/gcc, the resulting binary will have different contents. OK, I'm not wild about that, but that's what it is. However, I've recently run into a situation where the same code, built with the same version of gcc, is generating a binary with a different size than a prior build (by about 1900 bytes). Does anyone have any idea what may be causing either of these situations? Is this some kind of ELF issue? Are there any tools out there (other than ldd) that can be used to dump contents of binaries to see what exactly is different? Thanks in advance.

    Read the article

  • undefined reference to "func" when complied with GCC

    - by hotlemontea
    I implement a link list in two files in linklist.h and linklist.c, and I call some functions defined in linklist.h in main function of main.c. linklist.h is included in both linklist.c and main.c. When I compile this program by GCC with Makefile, the error named "undefined reference to xxx" occurs. I think my Makefile is written correctly as below. So what is the possible reason for this linking error CC=gcc CFLAGS= -g -O2 TARGET=target OBJECTS=main.o linklist.o TARGET: $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) clean: rm target $(OBJECTS) main.o:linklist.h linklist.o:linklist.h

    Read the article

  • Undefined reference to "func" when compiled with GCC

    - by hotlemontea
    I implement a link list in two files in linklist.h and linklist.c, and I call some functions defined in linklist.h in main function of main.c. linklist.h is included in both linklist.c and main.c. When I compile this program by GCC with Makefile, the error named "undefined reference to xxx" occurs. I think my Makefile is written correctly as below. So what is the possible reason for this linking error CC=gcc CFLAGS= -g -O2 TARGET=target OBJECTS=main.o linklist.o TARGET: $(OBJECTS) $(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET) clean: rm target $(OBJECTS) main.o:linklist.h linklist.o:linklist.h

    Read the article

  • GCC Dynamic library building problem

    - by Sirish Kumar
    I am new to linux, while compiling with dynamic library I am getting the segmentationfault error. I have two files ctest1.c void ctest1(int *i) { *i =10; } ctest2.c void ctest2(int *i) { *i =20; } I have compiled both files to a shared library named libtest.so using following command gcc -shared -W1,-soname,libtest.so.1 -o libtest.so.1.0.1 ctest1.o ctest2.o -lc And I have wrote another program prog.c which uses functions exported by this library prog.c #include void (ctest1)(int); void (ctest2)(int*); int main() { int a; ctest1(&a); printf("%d",a); return 0; } And when I have built the executable with following command gcc -Wall prog.c -L. -o prog But when I run the generated executable I get the SegmentationFault error. When I checked the header of prog with ldd it shows linux-vdso.so.1 = (0x00007f99dff000) libc.so.6 = /lib64/libc.so.6 (0x0007feeaa8c1000) /lib64/ld-linux-x86-64.so.2 (0x00007feeaac1c000) Can somebody tell what is the problem

    Read the article

  • GCC ICE -- alternative function syntax, variadic templates and tuples

    - by Marc H.
    (Related to C++0x, How do I expand a tuple into variadic template function arguments?.) The following code (see below) is taken from this discussion. The objective is to apply a function to a tuple. I simplified the template parameters and modified the code to allow for a return value of generic type. While the original code compiles fine, when I try to compile the modified code with GCC 4.4.3, g++ -std=c++0x main.cc -o main GCC reports an internal compiler error (ICE) with the following message: main.cc: In function ‘int main()’: main.cc:53: internal compiler error: in tsubst_copy, at cp/pt.c:10077 Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.4/README.Bugs> for instructions. Question: Is the code correct? or is the ICE triggered by illegal code? // file: main.cc #include <tuple> // Recursive case template<unsigned int N> struct Apply_aux { template<typename F, typename T, typename... X> static auto apply(F f, const T& t, X... x) -> decltype(Apply_aux<N-1>::apply(f, t, std::get<N-1>(t), x...)) { return Apply_aux<N-1>::apply(f, t, std::get<N-1>(t), x...); } }; // Terminal case template<> struct Apply_aux<0> { template<typename F, typename T, typename... X> static auto apply(F f, const T&, X... x) -> decltype(f(x...)) { return f(x...); } }; // Actual apply function template<typename F, typename T> auto apply(F f, const T& t) -> decltype(Apply_aux<std::tuple_size<T>::value>::apply(f, t)) { return Apply_aux<std::tuple_size<T>::value>::apply(f, t); } // Testing #include <string> #include <iostream> int f(int p1, double p2, std::string p3) { std::cout << "int=" << p1 << ", double=" << p2 << ", string=" << p3 << std::endl; return 1; } int g(int p1, std::string p2) { std::cout << "int=" << p1 << ", string=" << p2 << std::endl; return 2; } int main() { std::tuple<int, double, char const*> tup(1, 2.0, "xxx"); std::cout << apply(f, tup) << std::endl; std::cout << apply(g, std::make_tuple(4, "yyy")) << std::endl; } Remark: If I hardcode the return type in the recursive case (see code), then everything is fine. That is, substituting this snippet for the recursive case does not trigger the ICE: // Recursive case (hardcoded return type) template<unsigned int N> struct Apply_aux { template<typename F, typename T, typename... X> static int apply(F f, const T& t, X... x) { return Apply_aux<N-1>::apply(f, t, std::get<N-1>(t), x...); } }; Alas, this is an incomplete solution to the original problem.

    Read the article

  • What is the explanation for "warning: assuming that the loop is not infinite"

    - by James Morris
    I had just taken the decision to change as many variables from unsigned to int and upon recompiling the code in question, was greeted by this warning message: freespace_state.c:203: warning: assuming that the loop is not infinite The line in question: for (x = startx; x <= endx; ++x, ++xptr) This loop is 60 lines of code (inc white space/brackets etc), and has a goto within it, and at least one occurrence of continue. In this case, I think I am appreciative that GCC is assuming this loop is not infinite, because, it should never loop indefinitely. What is GCC trying to tell me here?

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >